diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5c9436e3a6..f0613afed6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -41,7 +41,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest] - node: [16] + node: [lts/*] steps: - uses: actions/checkout@v2 with: @@ -50,7 +50,7 @@ jobs: with: node-version: ${{ matrix.node }} - uses: ipfs/aegir/actions/cache-node-modules@master - - run: npm run test:node -- --since ${{ github.event.pull_request.base.sha }} --concurrency 1 + - run: npm run test:node - uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0 with: flags: node @@ -67,7 +67,7 @@ jobs: with: node-version: lts/* - uses: ipfs/aegir/actions/cache-node-modules@master - - run: npm run test:chrome -- --since ${{ github.event.pull_request.base.sha }} --concurrency 1 + - run: npm run test:chrome - uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0 with: flags: chrome @@ -84,7 +84,7 @@ jobs: with: node-version: lts/* - uses: ipfs/aegir/actions/cache-node-modules@master - - run: npm run test:chrome-webworker -- --since ${{ github.event.pull_request.base.sha }} --concurrency 1 + - run: npm run test:chrome-webworker - uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0 with: flags: chrome-webworker @@ -101,7 +101,7 @@ jobs: with: node-version: lts/* - uses: ipfs/aegir/actions/cache-node-modules@master - - run: npm run test:firefox -- --since ${{ github.event.pull_request.base.sha }} --concurrency 1 + - run: npm run test:firefox - uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0 with: flags: firefox @@ -119,7 +119,7 @@ jobs: node-version: lts/* - uses: ipfs/aegir/actions/cache-node-modules@master - run: npx playwright install --with-deps - - run: npm run test:firefox-webworker -- --since ${{ github.event.pull_request.base.sha }} --concurrency 1 + - run: npm run test:firefox-webworker - uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0 with: flags: firefox-webworker @@ -138,13 +138,14 @@ jobs: - uses: ipfs/aegir/actions/cache-node-modules@master - uses: GabrielBB/xvfb-action@v1 with: - run: npm run test:electron-main -- --since ${{ github.event.pull_request.base.sha }} --concurrency 1 -- -- --bail + run: npm run test:electron-main - uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0 with: flags: electron-main test-interop: name: Interop tests ${{ matrix.project }} ${{ matrix.type }} + needs: build runs-on: ubuntu-latest strategy: matrix: @@ -160,15 +161,14 @@ jobs: with: node-version: lts/* - uses: ipfs/aegir/actions/cache-node-modules@master - - run: npm install - - run: npm run build - - run: npm run test:interop -- --since ${{ github.event.pull_request.base.sha }} --concurrency 1 -- -- -- -t ${{ matrix.type }} --bail + - run: npm run test:interop -- -- -- -t ${{ matrix.type }} - uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0 with: flags: interop-${{ matrix.type }} test-interface: name: Interface tests ${{ matrix.suite }} ${{ matrix.type }} + needs: build runs-on: ubuntu-latest strategy: matrix: @@ -188,9 +188,8 @@ jobs: - uses: actions/setup-node@v2 with: node-version: lts/* - - run: npm install - - run: npm run build - - run: npm run ${{ matrix.suite }} -- --since ${{ github.event.pull_request.base.sha }} --concurrency 1 -- -- -t ${{ matrix.type }} + - uses: ipfs/aegir/actions/cache-node-modules@master + - run: npm run ${{ matrix.suite }} -- -- -t ${{ matrix.type }} - uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0 with: flags: interface-${{ matrix.type }} @@ -208,7 +207,7 @@ jobs: node-version: lts/* - uses: ipfs/aegir/actions/cache-node-modules@master - run: npx playwright install --with-deps - - run: npm run test:interface:message-port-client -- --since ${{ github.event.pull_request.base.sha }} --concurrency 1 + - run: npm run test:interface:message-port-client release: runs-on: ubuntu-latest @@ -263,8 +262,6 @@ jobs: - if: ${{ !steps.release.outputs.releases_created }} name: Run release rc run: | - git config --global user.email "github-actions[bot]@users.noreply.github.com" - git config --global user.name "github-actions[bot]" git update-index --assume-unchanged packages/ipfs-core/src/version.js packages/ipfs-http-server/src/version.js packages/ipfs/src/package.js npm run --if-present release:rc env: diff --git a/.release-please-manifest.json b/.release-please-manifest.json index da605357c8..87a8dd87be 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1 +1 @@ -{"packages/interface-ipfs-core":"0.156.1","packages/ipfs":"0.64.2","packages/ipfs-cli":"0.14.2","packages/ipfs-client":"0.9.1","packages/ipfs-core":"0.16.1","packages/ipfs-core-config":"0.5.1","packages/ipfs-core-types":"0.12.1","packages/ipfs-core-utils":"0.16.1","packages/ipfs-daemon":"0.14.2","packages/ipfs-grpc-client":"0.11.1","packages/ipfs-grpc-protocol":"0.7.0","packages/ipfs-grpc-server":"0.10.1","packages/ipfs-http-client":"58.0.1","packages/ipfs-http-gateway":"0.11.1","packages/ipfs-http-response":"4.0.1","packages/ipfs-http-server":"0.13.2","packages/ipfs-message-port-client":"0.13.1","packages/ipfs-message-port-protocol":"0.13.1","packages/ipfs-message-port-server":"0.13.1"} \ No newline at end of file +{"packages/interface-ipfs-core":"0.158.0","packages/ipfs":"0.66.0","packages/ipfs-cli":"0.16.0","packages/ipfs-client":"0.10.0","packages/ipfs-core":"0.18.0","packages/ipfs-core-config":"0.7.0","packages/ipfs-core-types":"0.14.0","packages/ipfs-core-utils":"0.18.0","packages/ipfs-daemon":"0.16.0","packages/ipfs-grpc-client":"0.13.0","packages/ipfs-grpc-protocol":"0.8.0","packages/ipfs-grpc-server":"0.12.0","packages/ipfs-http-client":"60.0.0","packages/ipfs-http-gateway":"0.13.0","packages/ipfs-http-response":"6.0.0","packages/ipfs-http-server":"0.15.0","packages/ipfs-message-port-client":"0.15.0","packages/ipfs-message-port-protocol":"0.15.0","packages/ipfs-message-port-server":"0.15.0"} \ No newline at end of file diff --git a/README.md b/README.md index 49da0064e0..fdb29bb110 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@

- +

diff --git a/docs/CONFIG.md b/docs/CONFIG.md index 546d9d1ddf..acfa8b2ac3 100644 --- a/docs/CONFIG.md +++ b/docs/CONFIG.md @@ -283,7 +283,7 @@ The "basic" connection manager tries to keep between `LowWater` and `HighWater` By default when running under nodejs, libp2p will try to use [UPnP](https://en.wikipedia.org/wiki/Universal_Plug_and_Play) to open a random high port on your router for any TCP connections you have configured. -Set `DisableNatPortMap` to `false` to disable this behaviour. +Set `DisableNatPortMap` to `true` to disable this behaviour. ### Example diff --git a/docs/DEVELOPMENT.md b/docs/DEVELOPMENT.md index 6ac3a4f7d9..d68f0e3974 100644 --- a/docs/DEVELOPMENT.md +++ b/docs/DEVELOPMENT.md @@ -31,7 +31,7 @@ $ npm install -g npm@latest > npm install ``` -This will install [lerna](https://www.npmjs.com/package/lerna) and bootstrap the various packages, deduping and hoisting dependencies into the root folder. +This will install the dependencies of the various packages, deduping and hoisting dependencies into the root folder. If later you add new dependencies to submodules or just wish to remove all the `node_modules`/`dist` folders and start again, run `npm run reset && npm install` from the root. diff --git a/docs/upgrading/v0.62-v0.63.md b/docs/upgrading/v0.62-v0.63.md index e931a9aa49..ed3dcb1c8e 100644 --- a/docs/upgrading/v0.62-v0.63.md +++ b/docs/upgrading/v0.62-v0.63.md @@ -1,12 +1,13 @@ # Migrating to ipfs@0.63 and ipfs-core@0.15 -> A migration guide for refactoring your application code from `ipfs@0.63.x` to `ipfs@0.64.x` +> A migration guide for refactoring your application code from `ipfs@0.62.x` to `ipfs@0.63.x` ## Table of Contents - [ESM](#esm) -- [libp2p@0.37.x](#libp2p037x) + - [TypeScript and ESM](#typescript-and-esm) +- [`libp2p@0.37.x`](#libp2p037x) - [PeerIds](#peerids) - [multiaddrs](#multiaddrs) @@ -34,11 +35,53 @@ async function loadIpfs () { } ``` +### TypeScript and ESM + +When authoring typescript it can often look like you are writing ESM: + +```ts +import { create } from 'ipfs-core' + +create() +``` + +When this is transpiled to JavaScript the default settings will emit CJS which will fail at runtime: + +```js +"use strict"; +exports.__esModule = true; +var ipfs_core_1 = require("ipfs-core"); +(0, ipfs_core_1.create)(); +``` + +You may also see errors about private identifiers: + +```console +node_modules/@libp2p/interfaces/dist/src/events.d.ts:19:5 - error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher. + +19 #private; + ~~~~~~~~ +``` + +To build correctly with ESM as a target, update your `tsconfig.json` to include the following: + +```js +{ + "module": "es2020", // ensures output is ESM + "target": "es2020", // support modern features like private identifiers + // other settings +} +``` + +They must both be set to `es2020` at least, more recent versions will also work. + +If in doubt, examine the JavaScript files `tsc` emits and ensure that any `ipfs` modules are being loaded with `import` and not `require`. + ## `libp2p@0.37.x` `ipfs@0.63.x` upgrades to `libp2p@0.37.x`. This is a significant refactor that ports the entire stack to TypeScript and publishes all modules as ESM-only code. -Please see the [libp2p 0.37.x upgrade guide](https://github.com/libp2p/js-libp2p/blob/master/doc/migrations/v0.36-v.037.md) for how this may affect your application. +Please see the [libp2p 0.37.x upgrade guide](https://github.com/libp2p/js-libp2p/blob/master/doc/migrations/v0.36-v0.37.md) for how this may affect your application. ## PeerIds diff --git a/docs/upgrading/v0.63-v0.64.md b/docs/upgrading/v0.63-v0.64.md new file mode 100644 index 0000000000..cc685da864 --- /dev/null +++ b/docs/upgrading/v0.63-v0.64.md @@ -0,0 +1,16 @@ + +# Migrating to ipfs@0.64 and ipfs-core@0.16 + +> A migration guide for refactoring your application code from `ipfs@0.63.x` to `ipfs@0.64.x` + +## Table of Contents + +- [libp2p](#libp2p) + +## libp2p + +The upgrade to `ipfs@0.64.x` incorporates an update to `libp2p@0.38.x` but no API changes. + +If your application uses only the default libp2p config there is nothing to do. + +If you supply a custom `libp2p` instance to the `ipfs` factory function you should consult the [`libp2p@0.38.x` upgrade guide](https://github.com/libp2p/js-libp2p/blob/master/doc/migrations/v0.37-v0.38.md) for any changes you need to make. diff --git a/docs/upgrading/v0.64-v0.65.md b/docs/upgrading/v0.64-v0.65.md new file mode 100644 index 0000000000..b765f0c91b --- /dev/null +++ b/docs/upgrading/v0.64-v0.65.md @@ -0,0 +1,23 @@ + +# Migrating to ipfs@0.65 and ipfs-core@0.17 + +> A migration guide for refactoring your application code from `ipfs@0.64.x` to `ipfs@0.65.x` + +## Table of Contents + +- [libp2p](#libp2p) +- [multiformats](#multiformats) + +## libp2p + +The upgrade to `ipfs@0.65.x` incorporates an update to `libp2p@0.40.x` but no API changes. + +If your application uses only the default libp2p config there is nothing to do. + +If you supply a custom `libp2p` instance to the `ipfs` factory function you should consult the [`libp2p@0.40.x` upgrade guide](https://github.com/libp2p/js-libp2p/blob/master/doc/migrations/v0.39-v0.40.md) for any changes you need to make. + +## multiformats + +`ipfs@0.65.x` now uses `multiformats@10.x.x`, this means instances of the `CID` class now come from that module and not `multiformats@9.x.x` so any `instanceof` checks your codebase has may break if instances are compare to the class loaded from a different module version. + +If your project also has a dependency on the `multiformats` module, it should be updated to `10.x.x` in line with js-ipfs. diff --git a/lerna.json b/lerna.json deleted file mode 100644 index 86c45bda4a..0000000000 --- a/lerna.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "version": "independent", - "useWorkspaces": true, - "command": { - "bootstrap": { - "hoist": true - }, - "run": { - "stream": true - }, - "publish": { - "message": "chore: publish", - "createRelease": "github", - "conventionalCommits": true, - "verifyAccess": false - }, - "version": { - "allowBranch": ["master", "release/*"], - "forcePublish": true, - "ignore-changes": [".github/**", "docs/**"] - } - } -} diff --git a/package.json b/package.json index e9d95e8489..e65d38e81a 100644 --- a/package.json +++ b/package.json @@ -17,40 +17,37 @@ }, "private": true, "scripts": { - "link": "lerna link", - "reset": "lerna run clean && rimraf packages/*/node_modules node_modules package-lock.json packages/*/package-lock.json", - "test": "lerna run test", - "test:node": "lerna run test:node", - "test:chrome": "lerna run test:chrome", - "test:chrome-webworker": "lerna run test:chrome-webworker", - "test:firefox": "lerna run test:firefox", - "test:firefox-webworker": "lerna run test:firefox-webworker", - "test:electron-main": "lerna run test:electron-main", - "test:external": "lerna run test:external", - "test:cli": "lerna run test:cli", - "test:interop": "lerna run test:interop", - "test:interface:client": "lerna run test:interface:client", - "test:interface:core": "lerna run test:interface:core", - "test:interface:http-go": "lerna run test:interface:http-go", - "test:interface:http-js": "lerna run test:interface:http-js", - "test:interface:message-port-client": "lerna run test:interface:message-port-client", - "coverage": "lerna run coverage", - "build": "lerna run build", - "clean": "lerna run clean", - "lint": "lerna run lint", - "dep-check": "lerna run dep-check", + "reset": "aegir run clean && aegir clean packages/*/node_modules node_modules package-lock.json packages/*/package-lock.json", + "test": "aegir run test", + "test:node": "aegir run test:node", + "test:chrome": "aegir run test:chrome", + "test:chrome-webworker": "aegir run test:chrome-webworker", + "test:firefox": "aegir run test:firefox", + "test:firefox-webworker": "aegir run test:firefox-webworker", + "test:electron-main": "aegir run test:electron-main", + "test:external": "aegir run test:external", + "test:cli": "aegir run test:cli", + "test:interop": "aegir run test:interop", + "test:interface:client": "aegir run test:interface:client", + "test:interface:core": "aegir run test:interface:core", + "test:interface:http-go": "aegir run test:interface:http-go", + "test:interface:http-js": "aegir run test:interface:http-js", + "test:interface:message-port-client": "aegir run test:interface:message-port-client", + "coverage": "aegir run coverage", + "build": "aegir run build", + "clean": "aegir run clean", + "lint": "aegir run lint", + "dep-check": "aegir run dep-check", "release": "run-s build npm:release docker:release", - "npm:release": "lerna publish from-package --no-push --no-private --yes", + "npm:release": "aegir exec npm -- publish", "docker:release": "run-s docker:release:*", "docker:release:build": "docker build . --no-cache --tag js-ipfs:latest --file ./Dockerfile.latest", "docker:release:tag-latest": "docker tag js-ipfs:latest docker.io/ipfs/js-ipfs:latest", "docker:release:tag-version": "docker tag js-ipfs:latest docker.io/ipfs/js-ipfs:v`npm show ipfs@latest version -q`", "docker:release:push-latest": "docker push ipfs/js-ipfs:latest", "docker:release:push-version": "docker push ipfs/js-ipfs:v`npm show ipfs@latest version -q`", - "release:rc": "run-s npm:rc:* docker:rc", - "npm:rc:version": "lerna version prerelease --preid `git rev-parse --short HEAD` --force-publish --no-push --yes", - "npm:rc:build": "npm run build", - "npm:rc:publish": "lerna publish from-package --no-push --no-private --dist-tag next --yes", + "release:rc": "run-s npm:rc docker:rc", + "npm:rc": "aegir release-rc", "docker:rc": "run-s docker:rc:*", "docker:rc:build": "docker build . --no-cache --tag js-ipfs:next --file ./Dockerfile.next", "docker:rc:tag-next": "docker tag js-ipfs:next docker.io/ipfs/js-ipfs:next", @@ -59,10 +56,8 @@ "docker:rc:push-rc": "docker push ipfs/js-ipfs:v`npm show ipfs@next version -q`" }, "devDependencies": { - "lerna": "^5.0.0", - "node-fetch": "npm:@achingbrain/node-fetch@^2.6.4", - "npm-run-all": "^4.1.5", - "rimraf": "^3.0.2" + "aegir": "^37.11.0", + "npm-run-all": "^4.1.5" }, "eslintConfig": { "extends": "ipfs", diff --git a/packages/interface-ipfs-core/CHANGELOG.md b/packages/interface-ipfs-core/CHANGELOG.md index 858c371c3d..91821881d1 100644 --- a/packages/interface-ipfs-core/CHANGELOG.md +++ b/packages/interface-ipfs-core/CHANGELOG.md @@ -3,6 +3,52 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.158.0](https://www.github.com/ipfs/js-ipfs/compare/interface-ipfs-core-v0.157.0...interface-ipfs-core-v0.158.0) (2023-01-11) + + +### ⚠ BREAKING CHANGES + +* update multiformats to v11.x.x and related depenendcies (#4277) + +### Bug Fixes + +* allow reading rawLeaves in MFS ([#4282](https://www.github.com/ipfs/js-ipfs/issues/4282)) ([0cfcaf6](https://www.github.com/ipfs/js-ipfs/commit/0cfcaf65998bdc2af0cc29ac48229bb3bc35c5b8)) +* disallow publishing pubsub messages to zero peers ([#4286](https://www.github.com/ipfs/js-ipfs/issues/4286)) ([fa578ba](https://www.github.com/ipfs/js-ipfs/commit/fa578bace93e459849a0ffcebbd6f222dc05652d)) +* mfs blob import for files larger than 262144b ([#4251](https://www.github.com/ipfs/js-ipfs/issues/4251)) ([6be5906](https://www.github.com/ipfs/js-ipfs/commit/6be59068cc99c517526bfa123ad475ae05fcbaef)), closes [#3601](https://www.github.com/ipfs/js-ipfs/issues/3601) [#3576](https://www.github.com/ipfs/js-ipfs/issues/3576) +* update multiformats to v11.x.x and related depenendcies ([#4277](https://www.github.com/ipfs/js-ipfs/issues/4277)) ([521c84a](https://www.github.com/ipfs/js-ipfs/commit/521c84a958b04d61702577a5adce28519c1b2a3b)) +* use aegir to publish RCs ([#4284](https://www.github.com/ipfs/js-ipfs/issues/4284)) ([6d90cbf](https://www.github.com/ipfs/js-ipfs/commit/6d90cbf321a7dbf4b1084ba20f0c514dc08d8d0a)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * ipfs-core-types bumped from ^0.13.0 to ^0.14.0 + +## [0.157.0](https://www.github.com/ipfs/js-ipfs/compare/interface-ipfs-core-v0.156.1...interface-ipfs-core-v0.157.0) (2022-10-24) + + +### ⚠ BREAKING CHANGES + +* ipfs is now bundled with libp2p@0.40.x which has different config +* require IPNS V2 signatures (#4207) + +### Features + +* upgrade libp2p to 0.40.x ([#4237](https://www.github.com/ipfs/js-ipfs/issues/4237)) ([0cee4a4](https://www.github.com/ipfs/js-ipfs/commit/0cee4a4c55767022584dcbade0b0b9b43326f9c9)) + + +### Bug Fixes + +* require IPNS V2 signatures ([#4207](https://www.github.com/ipfs/js-ipfs/issues/4207)) ([d1b0a8a](https://www.github.com/ipfs/js-ipfs/commit/d1b0a8a71073b4ece0dbda5a5405d76dd8d5b358)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * ipfs-core-types bumped from ^0.12.1 to ^0.13.0 + ### [0.156.1](https://www.github.com/ipfs/js-ipfs/compare/interface-ipfs-core-v0.156.0...interface-ipfs-core-v0.156.1) (2022-09-21) diff --git a/packages/interface-ipfs-core/README.md b/packages/interface-ipfs-core/README.md index 4e5b8b7989..1faa57c497 100644 --- a/packages/interface-ipfs-core/README.md +++ b/packages/interface-ipfs-core/README.md @@ -1,10 +1,9 @@ # interface-ipfs-core -[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io) -[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) -[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs) +[![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech) +[![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech) [![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs) -[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/js-test-and-release.yml) +[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/js-ipfs/test.yml?branch=master\&style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/test.yml?query=branch%3Amaster) > A test suite and interface you can use to implement a IPFS core interface. diff --git a/packages/interface-ipfs-core/package.json b/packages/interface-ipfs-core/package.json index b6fea6e411..1fe11ae1ef 100644 --- a/packages/interface-ipfs-core/package.json +++ b/packages/interface-ipfs-core/package.json @@ -1,6 +1,6 @@ { "name": "interface-ipfs-core", - "version": "0.156.1", + "version": "0.158.0", "description": "A test suite and interface you can use to implement a IPFS core interface.", "license": "Apache-2.0 OR MIT", "homepage": "https://github.com/ipfs/js-ipfs/tree/master/packages/interface-ipfs-core#readme", @@ -64,46 +64,46 @@ "dep-check": "aegir dep-check -i ipfs-core-types -i copyfiles -i @libp2p/interfaces" }, "dependencies": { - "@ipld/car": "^4.1.0", - "@ipld/dag-cbor": "^7.0.0", - "@ipld/dag-pb": "^2.1.3", - "@libp2p/crypto": "^1.0.0", - "@libp2p/interface-peer-id": "^1.0.4", - "@libp2p/interfaces": "^3.0.3", - "@libp2p/peer-id": "^1.1.10", - "@libp2p/peer-id-factory": "^1.0.10", - "@libp2p/websockets": "^3.0.0", - "@multiformats/multiaddr": "^11.0.0", + "@ipld/car": "^5.0.0", + "@ipld/dag-cbor": "^9.0.0", + "@ipld/dag-pb": "^4.0.0", + "@libp2p/crypto": "^1.0.7", + "@libp2p/interface-peer-id": "^2.0.0", + "@libp2p/interfaces": "^3.2.0", + "@libp2p/peer-id": "^2.0.0", + "@libp2p/peer-id-factory": "^2.0.0", + "@libp2p/websockets": "^5.0.0", + "@multiformats/multiaddr": "^11.1.5", "@types/node": "^18.0.0", "@types/pako": "^2.0.0", "@types/readable-stream": "^2.3.13", - "aegir": "^37.0.11", - "blockstore-core": "^2.0.1", + "aegir": "^37.11.0", + "blockstore-core": "^3.0.0", "copyfiles": "^2.4.1", - "dag-jose": "^2.0.1", + "dag-jose": "^4.0.0", "delay": "^5.0.0", "did-jwt": "^6.2.0", "err-code": "^3.0.1", - "ipfs-core-types": "^0.12.1", - "ipfs-unixfs": "^7.0.0", - "ipfs-unixfs-importer": "^10.0.2", - "ipfs-utils": "^9.0.6", - "ipns": "^3.0.0", - "is-ipfs": "^7.0.0", + "ipfs-core-types": "^0.14.0", + "ipfs-unixfs": "^9.0.0", + "ipfs-unixfs-importer": "^12.0.0", + "ipfs-utils": "^9.0.13", + "ipns": "^5.0.1", + "is-ipfs": "^8.0.0", "iso-random-stream": "^2.0.2", - "it-all": "^1.0.4", - "it-buffer-stream": "^2.0.0", - "it-concat": "^2.0.0", - "it-drain": "^1.0.3", - "it-first": "^1.0.6", - "it-last": "^1.0.4", - "it-map": "^1.0.6", + "it-all": "^2.0.0", + "it-buffer-stream": "^3.0.0", + "it-concat": "^3.0.1", + "it-drain": "^2.0.0", + "it-first": "^2.0.0", + "it-last": "^2.0.0", + "it-map": "^2.0.0", "it-pipe": "^2.0.3", "it-pushable": "^3.0.0", "it-tar": "^6.0.0", - "it-to-buffer": "^2.0.0", + "it-to-buffer": "^3.0.0", "merge-options": "^3.0.4", - "multiformats": "^9.5.1", + "multiformats": "^11.0.0", "nanoid": "^4.0.0", "p-defer": "^4.0.0", "p-map": "^5.3.0", @@ -111,8 +111,9 @@ "p-wait-for": "^5.0.0", "pako": "^2.0.4", "readable-stream": "^4.0.0", - "sinon": "^14.0.0", - "uint8arrays": "^3.0.0" + "sinon": "^15.0.1", + "uint8arrays": "^4.0.2", + "wherearewe": "^2.0.1" }, "browser": { "fs": false, diff --git a/packages/interface-ipfs-core/src/add-all.js b/packages/interface-ipfs-core/src/add-all.js index b56c5d1445..0e5efd94ea 100644 --- a/packages/interface-ipfs-core/src/add-all.js +++ b/packages/interface-ipfs-core/src/add-all.js @@ -76,8 +76,7 @@ export function testAddAll (factory, options) { it('should add a File as array of tuples', async function () { if (!supportsFileReader) { - // @ts-expect-error this is mocha - return this.skip('skip in node') + return this.skip() } const tuple = { @@ -102,8 +101,7 @@ export function testAddAll (factory, options) { it('should add array of objects with readable stream content', async function () { if (!isNode) { - // @ts-expect-error this is mocha - this.skip('Only node supports readable streams') + this.skip() } const expectedCid = 'QmVv4Wz46JaZJeH5PMV4LGbRiiMKEmszPYY3g6fjGnVXBS' @@ -336,7 +334,6 @@ export function testAddAll (factory, options) { }) it('should add a directory with only-hash=true', async function () { - // @ts-expect-error this is mocha this.slow(10 * 1000) const content = String(Math.random() + Date.now()) @@ -358,21 +355,18 @@ export function testAddAll (factory, options) { }) it('should add with mode as string', async function () { - // @ts-expect-error this is mocha this.slow(10 * 1000) const mode = '0777' await testMode(mode, parseInt(mode, 8)) }) it('should add with mode as number', async function () { - // @ts-expect-error this is mocha this.slow(10 * 1000) const mode = parseInt('0777', 8) await testMode(mode, mode) }) it('should add with mtime as Date', async function () { - // @ts-expect-error this is mocha this.slow(10 * 1000) const mtime = new Date(5000) await testMtime(mtime, { @@ -382,7 +376,6 @@ export function testAddAll (factory, options) { }) it('should add with mtime as { nsecs, secs }', async function () { - // @ts-expect-error this is mocha this.slow(10 * 1000) const mtime = { secs: 5, @@ -392,7 +385,6 @@ export function testAddAll (factory, options) { }) it('should add with mtime as timespec', async function () { - // @ts-expect-error this is mocha this.slow(10 * 1000) await testMtime({ Seconds: 5, @@ -404,7 +396,6 @@ export function testAddAll (factory, options) { }) it('should add with mtime as hrtime', async function () { - // @ts-expect-error this is mocha this.slow(10 * 1000) const mtime = process.hrtime() await testMtime(mtime, { @@ -414,7 +405,6 @@ export function testAddAll (factory, options) { }) it('should add a directory from the file system', async function () { - // @ts-expect-error this is mocha if (!isNode) this.skip() const filesPath = resolve('test/fixtures/test-folder', 'interface-ipfs-core') @@ -423,7 +413,6 @@ export function testAddAll (factory, options) { }) it('should add a directory from the file system with an odd name', async function () { - // @ts-expect-error this is mocha if (!isNode) this.skip() const filesPath = resolve('test/fixtures/weird name folder [v0]', 'interface-ipfs-core') @@ -433,7 +422,6 @@ export function testAddAll (factory, options) { }) it('should ignore a directory from the file system', async function () { - // @ts-expect-error this is mocha if (!isNode) this.skip() const filesPath = resolve('test/fixtures/test-folder', 'interface-ipfs-core') @@ -443,7 +431,6 @@ export function testAddAll (factory, options) { }) it('should add a file from the file system', async function () { - // @ts-expect-error this is mocha if (!isNode) this.skip() const filePath = resolve('test/fixtures/test-folder', 'interface-ipfs-core') @@ -454,7 +441,6 @@ export function testAddAll (factory, options) { }) it('should add a hidden file in a directory from the file system', async function () { - // @ts-expect-error this is mocha if (!isNode) this.skip() const filesPath = resolve('test/fixtures', 'interface-ipfs-core') @@ -465,10 +451,8 @@ export function testAddAll (factory, options) { }) it('should add a file with only-hash=true', async function () { - // @ts-expect-error this is mocha if (!isNode) this.skip() - // @ts-expect-error this is mocha this.slow(10 * 1000) const out = await all(ipfs.addAll([{ diff --git a/packages/interface-ipfs-core/src/add.js b/packages/interface-ipfs-core/src/add.js index 38cd90175b..1d0f05dec2 100644 --- a/packages/interface-ipfs-core/src/add.js +++ b/packages/interface-ipfs-core/src/add.js @@ -73,8 +73,7 @@ export function testAdd (factory, options) { it('should add a File', async function () { if (!supportsFileReader) { - // @ts-expect-error this is mocha - return this.skip('skip in node') + return this.skip() } const fileAdded = await ipfs.add(new File(['should add a File'], 'filename.txt', { type: 'text/plain' })) @@ -83,8 +82,7 @@ export function testAdd (factory, options) { it('should add a File as tuple', async function () { if (!supportsFileReader) { - // @ts-expect-error this is mocha - return this.skip('skip in node') + return this.skip() } const tuple = { @@ -212,7 +210,6 @@ export function testAdd (factory, options) { it('should add readable stream', async function () { if (!isNode) { - // @ts-expect-error this is mocha this.skip() } const expectedCid = 'QmVv4Wz46JaZJeH5PMV4LGbRiiMKEmszPYY3g6fjGnVXBS' @@ -264,7 +261,6 @@ export function testAdd (factory, options) { }) it('should add with only-hash=true', async function () { - // @ts-expect-error this is mocha this.slow(10 * 1000) const content = String(Math.random() + Date.now()) @@ -292,21 +288,18 @@ export function testAdd (factory, options) { }) it('should add with mode as string', async function () { - // @ts-expect-error this is mocha this.slow(10 * 1000) const mode = '0777' await testMode(mode, parseInt(mode, 8)) }) it('should add with mode as number', async function () { - // @ts-expect-error this is mocha this.slow(10 * 1000) const mode = parseInt('0777', 8) await testMode(mode, mode) }) it('should add with mtime as Date', async function () { - // @ts-expect-error this is mocha this.slow(10 * 1000) const mtime = new Date(5000) await testMtime(mtime, { @@ -316,7 +309,6 @@ export function testAdd (factory, options) { }) it('should add with mtime as { nsecs, secs }', async function () { - // @ts-expect-error this is mocha this.slow(10 * 1000) const mtime = { secs: 5, @@ -326,7 +318,6 @@ export function testAdd (factory, options) { }) it('should add with mtime as timespec', async function () { - // @ts-expect-error this is mocha this.slow(10 * 1000) await testMtime({ Seconds: 5, @@ -338,7 +329,6 @@ export function testAdd (factory, options) { }) it('should add with mtime as hrtime', async function () { - // @ts-expect-error this is mocha this.slow(10 * 1000) const mtime = process.hrtime() await testMtime(mtime, { diff --git a/packages/interface-ipfs-core/src/dag/export.js b/packages/interface-ipfs-core/src/dag/export.js index abd9ddd2dc..8a1b4cc0ab 100644 --- a/packages/interface-ipfs-core/src/dag/export.js +++ b/packages/interface-ipfs-core/src/dag/export.js @@ -72,7 +72,6 @@ export function testExport (factory, options) { }) it('export of shuffled devnet export identical to canonical original', async function () { - // @ts-expect-error this is mocha this.timeout(360000) const input = loadFixture('test/fixtures/car/lotus_devnet_genesis.car', 'interface-ipfs-core') @@ -83,7 +82,6 @@ export function testExport (factory, options) { }) it('export of shuffled testnet export identical to canonical original', async function () { - // @ts-expect-error this is mocha this.timeout(360000) const input = loadFixture('test/fixtures/car/lotus_testnet_export_128.car', 'interface-ipfs-core') diff --git a/packages/interface-ipfs-core/src/files/read.js b/packages/interface-ipfs-core/src/files/read.js index 1212cc4165..32ea03e468 100644 --- a/packages/interface-ipfs-core/src/files/read.js +++ b/packages/interface-ipfs-core/src/files/read.js @@ -112,6 +112,15 @@ export function testRead (factory, options) { expect(testFileData).to.eql(fixtures.smallFile.data) }) + it('should be able to read rawLeaves files', async () => { + const { cid } = await ipfs.add(fixtures.smallFile.data, { + rawLeaves: true + }) + await ipfs.files.cp(`/ipfs/${cid}`, '/raw-leaves.txt') + const testFileData = uint8ArrayConcat(await all(ipfs.files.read('/raw-leaves.txt'))) + expect(testFileData).to.eql(fixtures.smallFile.data) + }) + describe('with sharding', () => { /** @type {import('ipfs-core-types').IPFS} */ let ipfs diff --git a/packages/interface-ipfs-core/src/files/stat.js b/packages/interface-ipfs-core/src/files/stat.js index 04e949764f..3b63389c4a 100644 --- a/packages/interface-ipfs-core/src/files/stat.js +++ b/packages/interface-ipfs-core/src/files/stat.js @@ -11,6 +11,7 @@ import { identity } from 'multiformats/hashes/identity' import { randomBytes } from 'iso-random-stream' import isShardAtPath from '../utils/is-shard-at-path.js' import * as raw from 'multiformats/codecs/raw' +import { isBrowser } from 'wherearewe' /** * @typedef {import('ipfsd-ctl').Factory} Factory @@ -103,6 +104,27 @@ export function testStat (factory, options) { }) }) + it('should stat a large browser File', async function () { + if (!isBrowser) { + this.skip() + } + + const filePath = `/stat-${Math.random()}/large-file-${Math.random()}.txt` + const blob = new Blob([largeFile]) + + await ipfs.files.write(filePath, blob, { + create: true, + parents: true + }) + + await expect(ipfs.files.stat(filePath)).to.eventually.include({ + size: largeFile.length, + cumulativeSize: 490800, + blocks: 2, + type: 'file' + }) + }) + it('stats a raw node', async () => { const filePath = `/stat-${Math.random()}/large-file-${Math.random()}.txt` diff --git a/packages/interface-ipfs-core/src/files/touch.js b/packages/interface-ipfs-core/src/files/touch.js index 614a7bb17e..a4edfef830 100644 --- a/packages/interface-ipfs-core/src/files/touch.js +++ b/packages/interface-ipfs-core/src/files/touch.js @@ -53,7 +53,6 @@ export function testTouch (factory, options) { after(() => factory.clean()) it('should have default mtime', async function () { - // @ts-expect-error this is mocha this.slow(5 * 1000) const testPath = `/test-${nanoid()}` @@ -74,7 +73,6 @@ export function testTouch (factory, options) { }) it('should update file mtime', async function () { - // @ts-expect-error this is mocha this.slow(5 * 1000) const testPath = `/test-${nanoid()}` const mtime = new Date() @@ -92,7 +90,6 @@ export function testTouch (factory, options) { }) it('should update directory mtime', async function () { - // @ts-expect-error this is mocha this.slow(5 * 1000) const testPath = `/test-${nanoid()}` const mtime = new Date() diff --git a/packages/interface-ipfs-core/src/files/write.js b/packages/interface-ipfs-core/src/files/write.js index f3c7116ff2..4c4f148b75 100644 --- a/packages/interface-ipfs-core/src/files/write.js +++ b/packages/interface-ipfs-core/src/files/write.js @@ -188,7 +188,6 @@ export function testWrite (factory, options) { it('writes a small file using a Node stream (Node only)', async function () { if (!isNode) { - // @ts-expect-error this is mocha this.skip() } const filePath = `/small-file-${Math.random()}.txt` @@ -204,8 +203,7 @@ export function testWrite (factory, options) { }) it('writes a small file using an HTML5 Blob (Browser only)', async function () { - if (!global.Blob) { - // @ts-expect-error this is mocha + if (!global.Blob || !global.FileReader) { return this.skip() } diff --git a/packages/interface-ipfs-core/src/key/gen.js b/packages/interface-ipfs-core/src/key/gen.js index f09d9346d6..72511fe496 100644 --- a/packages/interface-ipfs-core/src/key/gen.js +++ b/packages/interface-ipfs-core/src/key/gen.js @@ -44,7 +44,6 @@ export function testGen (factory, options) { keyTypes.forEach((kt) => { it(`should generate a new ${kt.opts.type || 'default'} key`, async function () { - // @ts-expect-error this is mocha this.timeout(20 * 1000) const name = nanoid() const key = await ipfs.key.gen(name, kt.opts) @@ -61,8 +60,7 @@ export function testGen (factory, options) { } catch (/** @type {any} */ err) { if (err.code === 'ERR_NOT_IMPLEMENTED') { // key export is not exposed over the HTTP API - // @ts-expect-error this is mocha - this.skip('Cannot verify key type') + this.skip() } throw err diff --git a/packages/interface-ipfs-core/src/key/list.js b/packages/interface-ipfs-core/src/key/list.js index 15de84f4fe..9b85ac9742 100644 --- a/packages/interface-ipfs-core/src/key/list.js +++ b/packages/interface-ipfs-core/src/key/list.js @@ -27,7 +27,6 @@ export function testList (factory, options) { after(() => factory.clean()) it('should list all the keys', async function () { - // @ts-expect-error this is mocha this.timeout(60 * 1000) const keys = await Promise.all([1, 2, 3].map(() => ipfs.key.gen(nanoid(), { type: 'rsa', size: 2048 }))) diff --git a/packages/interface-ipfs-core/src/key/rename.js b/packages/interface-ipfs-core/src/key/rename.js index b8f4c1bc4a..6acfb6a35f 100644 --- a/packages/interface-ipfs-core/src/key/rename.js +++ b/packages/interface-ipfs-core/src/key/rename.js @@ -27,7 +27,6 @@ export function testRename (factory, options) { after(() => factory.clean()) it('should rename a key', async function () { - // @ts-expect-error this is mocha this.timeout(30 * 1000) const oldName = nanoid() diff --git a/packages/interface-ipfs-core/src/key/rm.js b/packages/interface-ipfs-core/src/key/rm.js index 5cde9bf106..f24771f1ec 100644 --- a/packages/interface-ipfs-core/src/key/rm.js +++ b/packages/interface-ipfs-core/src/key/rm.js @@ -27,7 +27,6 @@ export function testRm (factory, options) { after(() => factory.clean()) it('should rm a key', async function () { - // @ts-expect-error this is mocha this.timeout(30 * 1000) const key = await ipfs.key.gen(nanoid(), { type: 'rsa', size: 2048 }) diff --git a/packages/interface-ipfs-core/src/miscellaneous/dns.js b/packages/interface-ipfs-core/src/miscellaneous/dns.js index 36270e5e1d..8d7837d250 100644 --- a/packages/interface-ipfs-core/src/miscellaneous/dns.js +++ b/packages/interface-ipfs-core/src/miscellaneous/dns.js @@ -29,14 +29,20 @@ export function testDns (factory, options) { after(() => factory.clean()) it('should non-recursively resolve ipfs.io', async function () { + const domain = 'ipfs.io' + try { - const res = await ipfs.dns('ipfs.io', { recursive: false }) + const res = await ipfs.dns(domain, { recursive: false }) // matches pattern /ipns/ expect(res).to.match(/\/ipns\/.+$/) } catch (/** @type {any} */ err) { if (err.message.includes('could not resolve name')) { - // @ts-expect-error this is mocha + return this.skip() + } + + // happens when running tests offline + if (err.message.includes(`ECONNREFUSED ${domain}`)) { return this.skip() } @@ -45,14 +51,20 @@ export function testDns (factory, options) { }) it('should recursively resolve ipfs.io', async function () { + const domain = 'ipfs.io' + try { - const res = await ipfs.dns('ipfs.io', { recursive: true }) + const res = await ipfs.dns(domain, { recursive: true }) // matches pattern /ipfs/ expect(res).to.match(/\/ipfs\/.+$/) } catch (/** @type {any} */ err) { if (err.message.includes('could not resolve name')) { - // @ts-expect-error this is mocha + return this.skip() + } + + // happens when running tests offline + if (err.message.includes(`ECONNREFUSED ${domain}`)) { return this.skip() } @@ -61,14 +73,20 @@ export function testDns (factory, options) { }) it('should resolve subdomain docs.ipfs.io', async function () { + const domain = 'docs.ipfs.io' + try { - const res = await ipfs.dns('docs.ipfs.io') + const res = await ipfs.dns(domain) // matches pattern /ipfs/ expect(res).to.match(/\/ipfs\/.+$/) } catch (/** @type {any} */ err) { if (err.message.includes('could not resolve name')) { - // @ts-expect-error this is mocha + return this.skip() + } + + // happens when running tests offline + if (err.message.includes(`ECONNREFUSED ${domain}`)) { return this.skip() } diff --git a/packages/interface-ipfs-core/src/miscellaneous/id.js b/packages/interface-ipfs-core/src/miscellaneous/id.js index cd67e48ddf..59107c232c 100644 --- a/packages/interface-ipfs-core/src/miscellaneous/id.js +++ b/packages/interface-ipfs-core/src/miscellaneous/id.js @@ -59,7 +59,6 @@ export function testId (factory, options) { it('should return swarm ports opened after startup', async function () { if (isWebWorker) { // TODO: webworkers are not currently dialable - // @ts-expect-error this is mocha return this.skip() } @@ -69,7 +68,6 @@ export function testId (factory, options) { it('should get the id of another node in the swarm', async function () { if (isWebWorker) { // TODO: https://github.com/libp2p/js-libp2p-websockets/issues/129 - // @ts-expect-error this is mocha return this.skip() } diff --git a/packages/interface-ipfs-core/src/miscellaneous/resolve.js b/packages/interface-ipfs-core/src/miscellaneous/resolve.js index 8ca3fd0eba..3a2648e79a 100644 --- a/packages/interface-ipfs-core/src/miscellaneous/resolve.js +++ b/packages/interface-ipfs-core/src/miscellaneous/resolve.js @@ -94,15 +94,24 @@ export function testResolve (factory, options) { // Test resolve turns /ipns/domain.com into /ipfs/QmHash it('should resolve an IPNS DNS link', async function () { - // @ts-expect-error this is mocha this.retries(3) - const resolved = await ipfs.resolve('/ipns/ipfs.io') + const domain = 'ipfs.io' - expect(isIpfs.ipfsPath(resolved)).to.be.true() + try { + const resolved = await ipfs.resolve(`/ipns/${domain}`) + + expect(isIpfs.ipfsPath(resolved)).to.be.true() + } catch (/** @type {any} */ err) { + // happens when running tests offline + if (err.message.includes(`ECONNREFUSED ${domain}`)) { + return this.skip() + } + + throw err + } }) it('should resolve IPNS link recursively by default', async function () { - // @ts-expect-error this is mocha this.timeout(20 * 1000) // webworkers are not dialable because webrtc is not available const node = (await factory.spawn({ @@ -128,7 +137,6 @@ export function testResolve (factory, options) { }) it('should resolve IPNS link non-recursively if recursive==false', async function () { - // @ts-expect-error this is mocha this.timeout(20 * 1000) // webworkers are not dialable because webrtc is not available const node = (await factory.spawn({ diff --git a/packages/interface-ipfs-core/src/name-pubsub/cancel.js b/packages/interface-ipfs-core/src/name-pubsub/cancel.js index 39971ec5d8..a655840ad0 100644 --- a/packages/interface-ipfs-core/src/name-pubsub/cancel.js +++ b/packages/interface-ipfs-core/src/name-pubsub/cancel.js @@ -32,7 +32,6 @@ export function testCancel (factory, options) { after(() => factory.clean()) it('should return false when the name that is intended to cancel is not subscribed', async function () { - // @ts-expect-error this is mocha this.timeout(60 * 1000) const res = await ipfs.name.pubsub.cancel(nodeId) @@ -42,7 +41,6 @@ export function testCancel (factory, options) { }) it('should cancel a subscription correctly returning true', async function () { - // @ts-expect-error this is mocha this.timeout(300 * 1000) const peerId = await createEd25519PeerId() diff --git a/packages/interface-ipfs-core/src/name-pubsub/pubsub.js b/packages/interface-ipfs-core/src/name-pubsub/pubsub.js index 7849334951..77c2dd4cc8 100644 --- a/packages/interface-ipfs-core/src/name-pubsub/pubsub.js +++ b/packages/interface-ipfs-core/src/name-pubsub/pubsub.js @@ -82,13 +82,20 @@ export function testPubsub (factory, options) { after(() => factory.clean()) it('should publish and then resolve correctly', async function () { - // @ts-expect-error this is mocha this.timeout(80 * 1000) const routingKey = ipns.peerIdToRoutingKey(idA.id) const topic = `${namespace}${uint8ArrayToString(routingKey, 'base64url')}` await nodeB.pubsub.subscribe(topic, () => {}) + + // wait for nodeA to see nodeB's subscription + await waitFor(async () => { + const peers = await nodeA.pubsub.peers(topic) + + return peers.map(p => p.toString()).includes(idB.id.toString()) + }) + await nodeA.name.publish(ipfsRef, { resolve: false }) await delay(1000) // guarantee record is written @@ -98,7 +105,6 @@ export function testPubsub (factory, options) { }) it('should self resolve, publish and then resolve correctly', async function () { - // @ts-expect-error this is mocha this.timeout(6000) const emptyDirCid = '/ipfs/QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn' const { path } = await nodeA.add(uint8ArrayFromString('pubsub records')) @@ -120,7 +126,6 @@ export function testPubsub (factory, options) { }) it('should handle event on publish correctly', async function () { - // @ts-expect-error this is mocha this.timeout(80 * 1000) const testAccountName = 'test-account' @@ -152,6 +157,14 @@ export function testPubsub (factory, options) { const topic = `${namespace}${uint8ArrayToString(routingKey, 'base64url')}` await nodeB.pubsub.subscribe(topic, checkMessage) + + // wait for nodeA to see nodeB's subscription + await waitFor(async () => { + const peers = await nodeA.pubsub.peers(topic) + + return peers.map(p => p.toString()).includes(idB.id.toString()) + }) + await nodeA.name.publish(ipfsRef, { resolve: false, key: testAccountName }) await waitFor(alreadySubscribed) diff --git a/packages/interface-ipfs-core/src/name-pubsub/state.js b/packages/interface-ipfs-core/src/name-pubsub/state.js index 17ab98f449..fd966f6da4 100644 --- a/packages/interface-ipfs-core/src/name-pubsub/state.js +++ b/packages/interface-ipfs-core/src/name-pubsub/state.js @@ -26,7 +26,6 @@ export function testState (factory, options) { after(() => factory.clean()) it('should get the current state of pubsub', async function () { - // @ts-expect-error this is mocha this.timeout(50 * 1000) const res = await ipfs.name.pubsub.state() diff --git a/packages/interface-ipfs-core/src/name-pubsub/subs.js b/packages/interface-ipfs-core/src/name-pubsub/subs.js index 3f2d264204..558f3a7b86 100644 --- a/packages/interface-ipfs-core/src/name-pubsub/subs.js +++ b/packages/interface-ipfs-core/src/name-pubsub/subs.js @@ -27,7 +27,6 @@ export function testSubs (factory, options) { after(() => factory.clean()) it('should get an empty array as a result of subscriptions before any resolve', async function () { - // @ts-expect-error this is mocha this.timeout(60 * 1000) const res = await ipfs.name.pubsub.subs() @@ -36,7 +35,6 @@ export function testSubs (factory, options) { }) it('should get the list of subscriptions updated after a resolve', async function () { - // @ts-expect-error this is mocha this.timeout(300 * 1000) const id = 'QmNP1ASen5ZREtiJTtVD3jhMKhoPb1zppET1tgpjHx2NGA' diff --git a/packages/interface-ipfs-core/src/name/publish.js b/packages/interface-ipfs-core/src/name/publish.js index e44b806387..0cc06a70bb 100644 --- a/packages/interface-ipfs-core/src/name/publish.js +++ b/packages/interface-ipfs-core/src/name/publish.js @@ -46,7 +46,6 @@ export function testPublish (factory, options) { after(() => factory.clean()) it('should publish an IPNS record with the default params', async function () { - // @ts-expect-error this is mocha this.timeout(50 * 1000) const value = fixture.cid @@ -71,7 +70,6 @@ export function testPublish (factory, options) { }) it('should publish correctly when the file was not added but resolve is disabled', async function () { - // @ts-expect-error this is mocha this.timeout(50 * 1000) const value = 'QmPFVLPmp9zv5Z5KUqLhe2EivAGccQW2r7M7jhVJGLZoZU' @@ -97,7 +95,6 @@ export function testPublish (factory, options) { }) it('should publish with a key received as param, instead of using the key of the node', async function () { - // @ts-expect-error this is mocha this.timeout(90 * 1000) const value = fixture.cid diff --git a/packages/interface-ipfs-core/src/name/resolve.js b/packages/interface-ipfs-core/src/name/resolve.js index f1fa281733..4b5aa290c0 100644 --- a/packages/interface-ipfs-core/src/name/resolve.js +++ b/packages/interface-ipfs-core/src/name/resolve.js @@ -44,7 +44,6 @@ export function testResolve (factory, options) { after(() => factory.clean()) it('should resolve a record default options', async function () { - // @ts-expect-error this is mocha this.timeout(20 * 1000) const { path } = await ipfs.add(uint8ArrayFromString('should resolve a record default options')) @@ -58,7 +57,6 @@ export function testResolve (factory, options) { }) it('should resolve a record from peerid as cidv1 in base32', async function () { - // @ts-expect-error this is mocha this.timeout(20 * 1000) const { cid } = await ipfs.add(uint8ArrayFromString('should resolve a record from cidv1b32')) const { id: peerId } = await ipfs.id() @@ -80,7 +78,6 @@ export function testResolve (factory, options) { }) it('should resolve a record recursive === true', async function () { - // @ts-expect-error this is mocha this.timeout(20 * 1000) const { path } = await ipfs.add(uint8ArrayFromString('should resolve a record recursive === true')) @@ -94,7 +91,6 @@ export function testResolve (factory, options) { }) it('should resolve a record default options with remainder', async function () { - // @ts-expect-error this is mocha this.timeout(20 * 1000) const { path } = await ipfs.add(uint8ArrayFromString('should resolve a record default options with remainder')) @@ -115,7 +111,6 @@ export function testResolve (factory, options) { }) it('should resolve a record recursive === true with remainder', async function () { - // @ts-expect-error this is mocha this.timeout(20 * 1000) const { path } = await ipfs.add(uint8ArrayFromString('should resolve a record recursive = true with remainder')) @@ -160,34 +155,100 @@ export function testResolve (factory, options) { after(() => factory.clean()) - it('should resolve /ipns/ipfs.io', async () => { - expect(await last(ipfs.name.resolve('/ipns/ipfs.io'))) - .to.match(/\/ipfs\/.+$/) + it('should resolve /ipns/ipfs.io', async function () { + const domain = 'ipfs.io' + + try { + expect(await last(ipfs.name.resolve(`/ipns/${domain}`))) + .to.match(/\/ipfs\/.+$/) + } catch (/** @type {any} */ err) { + // happens when running tests offline + if (err.message.includes(`ECONNREFUSED ${domain}`)) { + return this.skip() + } + + throw err + } }) - it('should resolve /ipns/ipfs.io recursive === false', async () => { - expect(await last(ipfs.name.resolve('/ipns/ipfs.io', { recursive: false }))) - .to.match(/\/ipns\/.+$/) + it('should resolve /ipns/ipfs.io recursive === false', async function () { + const domain = 'ipfs.io' + + try { + expect(await last(ipfs.name.resolve(`/ipns/${domain}`, { recursive: false }))) + .to.match(/\/ipns\/.+$/) + } catch (/** @type {any} */ err) { + // happens when running tests offline + if (err.message.includes(`ECONNREFUSED ${domain}`)) { + return this.skip() + } + + throw err + } }) - it('should resolve /ipns/ipfs.io recursive === true', async () => { - expect(await last(ipfs.name.resolve('/ipns/ipfs.io', { recursive: true }))) - .to.match(/\/ipfs\/.+$/) + it('should resolve /ipns/ipfs.io recursive === true', async function () { + const domain = 'ipfs.io' + + try { + expect(await last(ipfs.name.resolve(`/ipns/${domain}`, { recursive: true }))) + .to.match(/\/ipfs\/.+$/) + } catch (/** @type {any} */ err) { + // happens when running tests offline + if (err.message.includes(`ECONNREFUSED ${domain}`)) { + return this.skip() + } + + throw err + } }) - it('should resolve /ipns/ipfs.io with remainder', async () => { - expect(await last(ipfs.name.resolve('/ipns/ipfs.io/images/ipfs-logo.svg'))) - .to.match(/\/ipfs\/.+\/images\/ipfs-logo.svg$/) + it('should resolve /ipns/ipfs.io with remainder', async function () { + const domain = 'ipfs.io' + + try { + expect(await last(ipfs.name.resolve(`/ipns/${domain}/images/ipfs-logo.svg`))) + .to.match(/\/ipfs\/.+\/images\/ipfs-logo.svg$/) + } catch (/** @type {any} */ err) { + // happens when running tests offline + if (err.message.includes(`ECONNREFUSED ${domain}`)) { + return this.skip() + } + + throw err + } }) - it('should resolve /ipns/ipfs.io with remainder recursive === false', async () => { - expect(await last(ipfs.name.resolve('/ipns/ipfs.io/images/ipfs-logo.svg', { recursive: false }))) - .to.match(/\/ipns\/.+\/images\/ipfs-logo.svg$/) + it('should resolve /ipns/ipfs.io with remainder recursive === false', async function () { + const domain = 'ipfs.io' + + try { + expect(await last(ipfs.name.resolve(`/ipns/${domain}/images/ipfs-logo.svg`, { recursive: false }))) + .to.match(/\/ipns\/.+\/images\/ipfs-logo.svg$/) + } catch (/** @type {any} */ err) { + // happens when running tests offline + if (err.message.includes(`ECONNREFUSED ${domain}`)) { + return this.skip() + } + + throw err + } }) - it('should resolve /ipns/ipfs.io with remainder recursive === true', async () => { - expect(await last(ipfs.name.resolve('/ipns/ipfs.io/images/ipfs-logo.svg', { recursive: true }))) - .to.match(/\/ipfs\/.+\/images\/ipfs-logo.svg$/) + it('should resolve /ipns/ipfs.io with remainder recursive === true', async function () { + const domain = 'ipfs.io' + + try { + expect(await last(ipfs.name.resolve(`/ipns/${domain}/images/ipfs-logo.svg`, { recursive: true }))) + .to.match(/\/ipfs\/.+\/images\/ipfs-logo.svg$/) + } catch (/** @type {any} */ err) { + // happens when running tests offline + if (err.message.includes(`ECONNREFUSED ${domain}`)) { + return this.skip() + } + + throw err + } }) it('should fail to resolve /ipns/ipfs.a', async () => { @@ -198,9 +259,20 @@ export function testResolve (factory, options) { } }) - it('should resolve ipns path with hamt-shard recursive === true', async () => { - expect(await last(ipfs.name.resolve('/ipns/tr.wikipedia-on-ipfs.org/wiki/Anasayfa.html', { recursive: true }))) - .to.match(/\/ipfs\/.+$/) + it('should resolve ipns path with hamt-shard recursive === true', async function () { + const domain = 'tr.wikipedia-on-ipfs.org' + + try { + expect(await last(ipfs.name.resolve(`/ipns/${domain}/wiki/Anasayfa.html`, { recursive: true }))) + .to.match(/\/ipfs\/.+$/) + } catch (/** @type {any} */ err) { + // happens when running tests offline + if (err.message.includes(`ECONNREFUSED ${domain}`)) { + return this.skip() + } + + throw err + } }) }) } diff --git a/packages/interface-ipfs-core/src/pin/add.js b/packages/interface-ipfs-core/src/pin/add.js index 3823cbac0d..62ab0c4a85 100644 --- a/packages/interface-ipfs-core/src/pin/add.js +++ b/packages/interface-ipfs-core/src/pin/add.js @@ -102,9 +102,7 @@ export function testAdd (factory, options) { }) it('should fail to pin a hash not in datastore', async function () { - // @ts-expect-error this is mocha this.slow(3 * 1000) - // @ts-expect-error this is mocha this.timeout(5 * 1000) const falseHash = `${`${fixtures.directory.cid}`.slice(0, -2)}ss` @@ -113,9 +111,7 @@ export function testAdd (factory, options) { }) it('needs all children in datastore to pin recursively', async function () { - // @ts-expect-error this is mocha this.slow(3 * 1000) - // @ts-expect-error this is mocha this.timeout(5 * 1000) await all(ipfs.block.rm(fixtures.directory.files[0].cid)) diff --git a/packages/interface-ipfs-core/src/pubsub/publish.js b/packages/interface-ipfs-core/src/pubsub/publish.js index 3986adac4b..7af4b1c0ba 100644 --- a/packages/interface-ipfs-core/src/pubsub/publish.js +++ b/packages/interface-ipfs-core/src/pubsub/publish.js @@ -5,11 +5,30 @@ import { nanoid } from 'nanoid' import { getTopic } from './utils.js' import { expect } from 'aegir/chai' import { getDescribe, getIt } from '../utils/mocha.js' +import pWaitFor from 'p-wait-for' /** * @typedef {import('ipfsd-ctl').Factory} Factory + * @typedef {import('ipfs-core-types').IPFS} IPFS */ +/** + * @param {string} topic + * @param {IPFS} ipfs + * @param {IPFS} remote + */ +async function waitForRemoteToBeSubscribed (topic, ipfs, remote) { + await remote.pubsub.subscribe(topic, () => {}) + const remoteId = await remote.id() + + // wait for remote to be subscribed to topic + await pWaitFor(async () => { + const peers = await ipfs.pubsub.peers(topic) + + return peers.map(p => p.toString()).includes(remoteId.id.toString()) + }) +} + /** * @param {Factory} factory * @param {object} options @@ -21,23 +40,37 @@ export function testPublish (factory, options) { describe('.pubsub.publish', function () { this.timeout(80 * 1000) - /** @type {import('ipfs-core-types').IPFS} */ + /** @type {IPFS} */ let ipfs + /** @type {IPFS} */ + let remote + before(async () => { ipfs = (await factory.spawn()).api + remote = (await factory.spawn()).api + + // ensure we have peers to allow publishing + const remoteId = await remote.id() + await ipfs.swarm.connect(remoteId.addresses[0]) }) after(() => factory.clean()) it('should fail with undefined msg', async () => { const topic = getTopic() + + await waitForRemoteToBeSubscribed(topic, ipfs, remote) + // @ts-expect-error invalid parameter await expect(ipfs.pubsub.publish(topic)).to.eventually.be.rejected() }) - it('should publish message from buffer', () => { + it('should publish message from buffer', async () => { const topic = getTopic() + + await waitForRemoteToBeSubscribed(topic, ipfs, remote) + return ipfs.pubsub.publish(topic, uint8ArrayFromString(nanoid())) }) @@ -45,6 +78,8 @@ export function testPublish (factory, options) { const count = 10 const topic = getTopic() + await waitForRemoteToBeSubscribed(topic, ipfs, remote) + for (let i = 0; i < count; i++) { await ipfs.pubsub.publish(topic, uint8ArrayFromString(nanoid())) } diff --git a/packages/interface-ipfs-core/src/pubsub/subscribe.js b/packages/interface-ipfs-core/src/pubsub/subscribe.js index bad06e4015..87ecd48f7b 100644 --- a/packages/interface-ipfs-core/src/pubsub/subscribe.js +++ b/packages/interface-ipfs-core/src/pubsub/subscribe.js @@ -194,7 +194,6 @@ export function testSubscribe (factory, options) { it('should receive messages from a different node with floodsub', async function () { if (!isNode) { - // @ts-expect-error this is mocha return this.skip() } diff --git a/packages/interface-ipfs-core/src/refs.js b/packages/interface-ipfs-core/src/refs.js index 8bea1e73e3..739447410a 100644 --- a/packages/interface-ipfs-core/src/refs.js +++ b/packages/interface-ipfs-core/src/refs.js @@ -50,7 +50,6 @@ export function testRefs (factory, options) { const { path, params, expected, expectError, expectTimeout } = options // eslint-disable-next-line no-loop-func it(name, async function () { - // @ts-expect-error this is mocha this.timeout(20 * 1000) // Call out to IPFS @@ -81,7 +80,6 @@ export function testRefs (factory, options) { }) it('should get refs with cbor links', async function () { - // @ts-expect-error this is mocha this.timeout(20 * 1000) // Call out to IPFS diff --git a/packages/interface-ipfs-core/src/utils/ipfs-options-websockets-filter-all.js b/packages/interface-ipfs-core/src/utils/ipfs-options-websockets-filter-all.js index 88bc5c0ac1..b41ac55df2 100644 --- a/packages/interface-ipfs-core/src/utils/ipfs-options-websockets-filter-all.js +++ b/packages/interface-ipfs-core/src/utils/ipfs-options-websockets-filter-all.js @@ -1,4 +1,4 @@ -import { WebSockets } from '@libp2p/websockets' +import { webSockets } from '@libp2p/websockets' import { all } from '@libp2p/websockets/filters' export function ipfsOptionsWebsocketsFilterAll () { @@ -6,7 +6,7 @@ export function ipfsOptionsWebsocketsFilterAll () { libp2p: { config: { transports: [ - new WebSockets({ + webSockets({ filter: all }) ] diff --git a/packages/interface-ipfs-core/src/utils/mocha.js b/packages/interface-ipfs-core/src/utils/mocha.js index df6b791a71..cf90f1f74e 100644 --- a/packages/interface-ipfs-core/src/utils/mocha.js +++ b/packages/interface-ipfs-core/src/utils/mocha.js @@ -93,16 +93,20 @@ export function getDescribe (config) { * @param {object} [config] * @param {boolean | Skip | (string | Skip)[]} [config.skip] * @param {boolean} [config.only] + * @returns {Mocha.TestFunction} */ export function getIt (config) { if (!config) return it /** - * @param {string} name - * @param {*} impl - * @returns + * @param {string | Mocha.Func} name + * @param {Mocha.Func | Mocha.AsyncFunc} [impl] */ const _it = (name, impl) => { + if (typeof name !== 'string') { + throw new Error('Pass test name as first argument to it') + } + if (Array.isArray(config.skip)) { const skip = config.skip .map((s) => isSkip(s) ? s : { name: s, reason: '🤷' }) @@ -125,9 +129,10 @@ export function getIt (config) { } } - it(name, impl) + return it(name, impl) } + _it.retries = it.retries _it.skip = it.skip _it.only = it.only // eslint-disable-line no-only-tests/no-only-tests diff --git a/packages/ipfs-cli/CHANGELOG.md b/packages/ipfs-cli/CHANGELOG.md index e3c70a2390..2e2faace5e 100644 --- a/packages/ipfs-cli/CHANGELOG.md +++ b/packages/ipfs-cli/CHANGELOG.md @@ -3,6 +3,56 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.16.0](https://www.github.com/ipfs/js-ipfs/compare/ipfs-cli-v0.15.0...ipfs-cli-v0.16.0) (2023-01-11) + + +### ⚠ BREAKING CHANGES + +* update multiformats to v11.x.x and related depenendcies (#4277) + +### Bug Fixes + +* update multiformats to v11.x.x and related depenendcies ([#4277](https://www.github.com/ipfs/js-ipfs/issues/4277)) ([521c84a](https://www.github.com/ipfs/js-ipfs/commit/521c84a958b04d61702577a5adce28519c1b2a3b)) +* use aegir to publish RCs ([#4284](https://www.github.com/ipfs/js-ipfs/issues/4284)) ([6d90cbf](https://www.github.com/ipfs/js-ipfs/commit/6d90cbf321a7dbf4b1084ba20f0c514dc08d8d0a)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * ipfs-core bumped from ^0.17.0 to ^0.18.0 + * ipfs-core-types bumped from ^0.13.0 to ^0.14.0 + * ipfs-core-utils bumped from ^0.17.0 to ^0.18.0 + * ipfs-daemon bumped from ^0.15.0 to ^0.16.0 + * ipfs-http-client bumped from ^59.0.0 to ^60.0.0 + +## [0.15.0](https://www.github.com/ipfs/js-ipfs/compare/ipfs-cli-v0.14.2...ipfs-cli-v0.15.0) (2022-10-24) + + +### ⚠ BREAKING CHANGES + +* ipfs is now bundled with libp2p@0.40.x which has different config + +### Features + +* upgrade libp2p to 0.40.x ([#4237](https://www.github.com/ipfs/js-ipfs/issues/4237)) ([0cee4a4](https://www.github.com/ipfs/js-ipfs/commit/0cee4a4c55767022584dcbade0b0b9b43326f9c9)) + + +### Bug Fixes + +* replace slice with subarray for increased performance ([#4210](https://www.github.com/ipfs/js-ipfs/issues/4210)) ([dfc43d4](https://www.github.com/ipfs/js-ipfs/commit/dfc43d4e9be67fdf25553677f469379d966ff806)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * ipfs-core bumped from ^0.16.1 to ^0.17.0 + * ipfs-core-types bumped from ^0.12.1 to ^0.13.0 + * ipfs-core-utils bumped from ^0.16.1 to ^0.17.0 + * ipfs-daemon bumped from ^0.14.2 to ^0.15.0 + * ipfs-http-client bumped from ^58.0.1 to ^59.0.0 + ### [0.14.2](https://www.github.com/ipfs/js-ipfs/compare/ipfs-cli-v0.14.1...ipfs-cli-v0.14.2) (2022-09-21) diff --git a/packages/ipfs-cli/README.md b/packages/ipfs-cli/README.md index 1ec7e2843e..4445a75cc9 100644 --- a/packages/ipfs-cli/README.md +++ b/packages/ipfs-cli/README.md @@ -1,10 +1,9 @@ # ipfs-cli -[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io) -[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) -[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs) +[![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech) +[![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech) [![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs) -[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/js-test-and-release.yml) +[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/js-ipfs/test.yml?branch=master\&style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/test.yml?query=branch%3Amaster) > JavaScript implementation of the IPFS specification diff --git a/packages/ipfs-cli/package.json b/packages/ipfs-cli/package.json index 5156fddad3..1a16285f65 100644 --- a/packages/ipfs-cli/package.json +++ b/packages/ipfs-cli/package.json @@ -1,6 +1,6 @@ { "name": "ipfs-cli", - "version": "0.14.2", + "version": "0.16.0", "description": "JavaScript implementation of the IPFS specification", "license": "Apache-2.0 OR MIT", "homepage": "https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-cli#readme", @@ -67,55 +67,55 @@ "build": "aegir build --no-bundle" }, "dependencies": { - "@ipld/dag-cbor": "^7.0.0", - "@ipld/dag-json": "^8.0.1", - "@ipld/dag-pb": "^2.1.3", - "@libp2p/logger": "^2.0.0", - "@libp2p/peer-id": "^1.1.10", + "@ipld/dag-cbor": "^9.0.0", + "@ipld/dag-json": "^10.0.0", + "@ipld/dag-pb": "^4.0.0", + "@libp2p/logger": "^2.0.5", + "@libp2p/peer-id": "^2.0.0", "@multiformats/mafmt": "^11.0.2", - "@multiformats/multiaddr": "^11.0.0", + "@multiformats/multiaddr": "^11.1.5", "@multiformats/multiaddr-to-uri": "^9.0.1", "byteman": "^1.3.5", "execa": "^6.1.0", "get-folder-size": "^4.0.0", - "ipfs-core": "^0.16.1", - "ipfs-core-types": "^0.12.1", - "ipfs-core-utils": "^0.16.1", - "ipfs-daemon": "^0.14.2", - "ipfs-http-client": "^58.0.1", - "ipfs-utils": "^9.0.6", - "it-concat": "^2.0.0", - "it-merge": "^1.0.3", + "ipfs-core": "^0.18.0", + "ipfs-core-types": "^0.14.0", + "ipfs-core-utils": "^0.18.0", + "ipfs-daemon": "^0.16.0", + "ipfs-http-client": "^60.0.0", + "ipfs-utils": "^9.0.13", + "it-concat": "^3.0.1", + "it-merge": "^2.0.0", "it-pipe": "^2.0.3", - "it-split": "^1.0.0", + "it-split": "^2.0.0", "it-tar": "^6.0.0", "jsondiffpatch": "^0.4.1", - "multiformats": "^9.5.1", + "multiformats": "^11.0.0", "parse-duration": "^1.0.0", "pretty-bytes": "^6.0.0", "progress": "^2.0.3", "stream-to-it": "^0.2.2", - "uint8arrays": "^3.0.0", + "uint8arrays": "^4.0.2", "yargs": "^17.4.0" }, "devDependencies": { - "@libp2p/crypto": "^1.0.0", + "@libp2p/crypto": "^1.0.7", "@types/get-folder-size": "^3.0.1", "@types/ncp": "^2.0.5", "@types/progress": "^2.0.3", "@types/rimraf": "^3.0.1", "@types/yargs": "^17.0.10", - "aegir": "^37.0.11", - "ipfs-repo": "^15.0.3", - "it-all": "^1.0.4", - "it-first": "^1.0.4", - "it-map": "^1.0.6", - "it-to-buffer": "^2.0.0", + "aegir": "^37.11.0", + "ipfs-repo": "^17.0.0", + "it-all": "^2.0.0", + "it-first": "^2.0.0", + "it-map": "^2.0.0", + "it-to-buffer": "^3.0.0", "nanoid": "^4.0.0", "ncp": "^2.0.0", "pako": "^2.0.4", "rimraf": "^3.0.2", - "sinon": "^14.0.0", + "sinon": "^15.0.1", "string-argv": "^0.3.1", "temp-write": "^5.0.0" } diff --git a/packages/ipfs-cli/src/commands/add.js b/packages/ipfs-cli/src/commands/add.js index e5c2434ae6..77f81e768b 100644 --- a/packages/ipfs-cli/src/commands/add.js +++ b/packages/ipfs-cli/src/commands/add.js @@ -86,7 +86,7 @@ async function * getSource (target, options = {}) { * @property {import('../types').Context} Argv.ctx * @property {boolean} Argv.trickle * @property {number} Argv.shardSplitThreshold - * @property {import('multiformats/cid').CIDVersion} Argv.cidVersion + * @property {import('multiformats/cid').Version} Argv.cidVersion * @property {boolean} Argv.rawLeaves * @property {boolean} Argv.onlyHash * @property {string} Argv.hash diff --git a/packages/ipfs-cli/src/commands/block/put.js b/packages/ipfs-cli/src/commands/block/put.js index 2f4b1607dc..8156286037 100644 --- a/packages/ipfs-cli/src/commands/block/put.js +++ b/packages/ipfs-cli/src/commands/block/put.js @@ -9,7 +9,7 @@ import parseDuration from 'parse-duration' * @property {string} Argv.format * @property {string} Argv.mhtype * @property {number} Argv.mhlen - * @property {import('multiformats/cid').CIDVersion} Argv.version + * @property {import('multiformats/cid').Version} Argv.version * @property {boolean} Argv.pin * @property {string} Argv.cidBase * @property {number} Argv.timeout @@ -62,7 +62,7 @@ const command = { if (block) { data = fs.readFileSync(block) } else { - data = (await concat(getStdin(), { type: 'buffer' })).slice() + data = (await concat(getStdin(), { type: 'buffer' })).subarray() } const cid = await ipfs.block.put(data, { diff --git a/packages/ipfs-cli/src/commands/cid/base32.js b/packages/ipfs-cli/src/commands/cid/base32.js index 5cba80a1aa..9f9a932387 100644 --- a/packages/ipfs-cli/src/commands/cid/base32.js +++ b/packages/ipfs-cli/src/commands/cid/base32.js @@ -1,6 +1,7 @@ import split from 'it-split' import { CID } from 'multiformats/cid' import { base32 } from 'multiformats/bases/base32' +import { toString as uint8arrayToString } from 'uint8arrays/to-string' /** * @typedef {object} Argv @@ -24,7 +25,7 @@ const command = { } for await (const data of input) { - const input = data.toString().trim() + const input = (data instanceof Uint8Array ? uint8arrayToString(data) : data).trim() if (!input) { continue diff --git a/packages/ipfs-cli/src/commands/cid/format.js b/packages/ipfs-cli/src/commands/cid/format.js index 9e680d6bef..8a0f4984f1 100644 --- a/packages/ipfs-cli/src/commands/cid/format.js +++ b/packages/ipfs-cli/src/commands/cid/format.js @@ -6,7 +6,7 @@ import { CID } from 'multiformats/cid' * @property {import('../../types').Context} Argv.ctx * @property {string[]} [Argv.cids] * @property {string} [Argv.format] - * @property {import('multiformats/cid').CIDVersion} [Argv.cidVersion] + * @property {import('multiformats/cid').Version} [Argv.cidVersion] * @property {string} [Argv.base] */ diff --git a/packages/ipfs-cli/src/commands/dag/put.js b/packages/ipfs-cli/src/commands/dag/put.js index d6de5428ad..d82f7a83c1 100644 --- a/packages/ipfs-cli/src/commands/dag/put.js +++ b/packages/ipfs-cli/src/commands/dag/put.js @@ -24,7 +24,7 @@ const codecs = [dagCBOR, dagJSON, dagPB, raw].reduce((/** @type {Record { const out = await cli('object put', { ipfs, getStdin: function * () { - yield Buffer.from('{}') + yield uint8ArrayFromString('{}') } }) @@ -431,7 +431,7 @@ describe('object', () => { it('append data from pipe', async () => { ipfs.bases.getBase.withArgs('base58btc').returns(base58btc) - const buf = Buffer.from('hello world') + const buf = uint8ArrayFromString('hello world') ipfs.object.patch.appendData.withArgs(cid, buf, defaultOptions).resolves( cid @@ -496,7 +496,7 @@ describe('object', () => { it('set-data from pipe', async () => { ipfs.bases.getBase.withArgs('base58btc').returns(base58btc) - const buf = Buffer.from('hello world') + const buf = uint8ArrayFromString('hello world') ipfs.object.patch.setData.withArgs(cid, buf, defaultOptions).resolves( cid diff --git a/packages/ipfs-client/CHANGELOG.md b/packages/ipfs-client/CHANGELOG.md index a84a6bce7f..854465488a 100644 --- a/packages/ipfs-client/CHANGELOG.md +++ b/packages/ipfs-client/CHANGELOG.md @@ -3,6 +3,36 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.10.0](https://www.github.com/ipfs/js-ipfs/compare/ipfs-client-v0.9.2...ipfs-client-v0.10.0) (2023-01-11) + + +### ⚠ BREAKING CHANGES + +* update multiformats to v11.x.x and related depenendcies (#4277) + +### Bug Fixes + +* update multiformats to v11.x.x and related depenendcies ([#4277](https://www.github.com/ipfs/js-ipfs/issues/4277)) ([521c84a](https://www.github.com/ipfs/js-ipfs/commit/521c84a958b04d61702577a5adce28519c1b2a3b)) +* use aegir to publish RCs ([#4284](https://www.github.com/ipfs/js-ipfs/issues/4284)) ([6d90cbf](https://www.github.com/ipfs/js-ipfs/commit/6d90cbf321a7dbf4b1084ba20f0c514dc08d8d0a)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * ipfs-grpc-client bumped from ^0.12.0 to ^0.13.0 + * ipfs-http-client bumped from ^59.0.0 to ^60.0.0 + +### [0.9.2](https://www.github.com/ipfs/js-ipfs/compare/ipfs-client-v0.9.1...ipfs-client-v0.9.2) (2022-10-24) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * ipfs-grpc-client bumped from ^0.11.1 to ^0.12.0 + * ipfs-http-client bumped from ^58.0.1 to ^59.0.0 + ### [0.9.1](https://www.github.com/ipfs/js-ipfs/compare/ipfs-client-v0.9.0...ipfs-client-v0.9.1) (2022-09-21) @@ -386,4 +416,4 @@ Co-authored-by: achingbrain ### Features * add grpc server and client ([#3403](https://github.com/ipfs/js-ipfs/issues/3403)) ([a9027e0](https://github.com/ipfs/js-ipfs/commit/a9027e0ec0cea9a4f34b4f2f52e09abb35237384)), closes [#2519](https://github.com/ipfs/js-ipfs/issues/2519) [#2838](https://github.com/ipfs/js-ipfs/issues/2838) [#2943](https://github.com/ipfs/js-ipfs/issues/2943) [#2854](https://github.com/ipfs/js-ipfs/issues/2854) [#2864](https://github.com/ipfs/js-ipfs/issues/2864) -* allow passing a http.Agent to the grpc client ([#3477](https://github.com/ipfs/js-ipfs/issues/3477)) ([c5f0bc5](https://github.com/ipfs/js-ipfs/commit/c5f0bc5eeee15369b7d02901035b04184a8608d2)), closes [#3474](https://github.com/ipfs/js-ipfs/issues/3474) +* allow passing a http.Agent to the grpc client ([#3477](https://github.com/ipfs/js-ipfs/issues/3477)) ([c5f0bc5](https://github.com/ipfs/js-ipfs/commit/c5f0bc5eeee15369b7d02901035b04184a8608d2)), closes [#3474](https://github.com/ipfs/js-ipfs/issues/3474) \ No newline at end of file diff --git a/packages/ipfs-client/README.md b/packages/ipfs-client/README.md index 468fcc47aa..cc76636339 100644 --- a/packages/ipfs-client/README.md +++ b/packages/ipfs-client/README.md @@ -1,10 +1,9 @@ # ipfs-client -[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io) -[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) -[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs) +[![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech) +[![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech) [![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs) -[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/js-test-and-release.yml) +[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/js-ipfs/test.yml?branch=master\&style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/test.yml?query=branch%3Amaster) > A client library to talk to local IPFS daemons diff --git a/packages/ipfs-client/package.json b/packages/ipfs-client/package.json index 71c6cb0730..3105cf8ef9 100644 --- a/packages/ipfs-client/package.json +++ b/packages/ipfs-client/package.json @@ -1,6 +1,6 @@ { "name": "ipfs-client", - "version": "0.9.1", + "version": "0.10.0", "description": "A client library to talk to local IPFS daemons", "license": "Apache-2.0 OR MIT", "homepage": "https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-client#readme", @@ -61,11 +61,11 @@ "dep-check": "aegir dep-check -i aegir" }, "dependencies": { - "ipfs-grpc-client": "^0.11.1", - "ipfs-http-client": "^58.0.1", + "ipfs-grpc-client": "^0.13.0", + "ipfs-http-client": "^60.0.0", "merge-options": "^3.0.4" }, "devDependencies": { - "aegir": "^37.0.11" + "aegir": "^37.11.0" } } diff --git a/packages/ipfs-core-config/CHANGELOG.md b/packages/ipfs-core-config/CHANGELOG.md index a66a6ce3bf..3e184a6e46 100644 --- a/packages/ipfs-core-config/CHANGELOG.md +++ b/packages/ipfs-core-config/CHANGELOG.md @@ -3,6 +3,44 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.7.0](https://www.github.com/ipfs/js-ipfs/compare/ipfs-core-config-v0.6.0...ipfs-core-config-v0.7.0) (2023-01-11) + + +### ⚠ BREAKING CHANGES + +* update multiformats to v11.x.x and related depenendcies (#4277) + +### Bug Fixes + +* disallow publishing pubsub messages to zero peers ([#4286](https://www.github.com/ipfs/js-ipfs/issues/4286)) ([fa578ba](https://www.github.com/ipfs/js-ipfs/commit/fa578bace93e459849a0ffcebbd6f222dc05652d)) +* update multiformats to v11.x.x and related depenendcies ([#4277](https://www.github.com/ipfs/js-ipfs/issues/4277)) ([521c84a](https://www.github.com/ipfs/js-ipfs/commit/521c84a958b04d61702577a5adce28519c1b2a3b)) +* use aegir to publish RCs ([#4284](https://www.github.com/ipfs/js-ipfs/issues/4284)) ([6d90cbf](https://www.github.com/ipfs/js-ipfs/commit/6d90cbf321a7dbf4b1084ba20f0c514dc08d8d0a)) + + +### Dependencies + +* The following workspace dependencies were updated + * devDependencies + * ipfs-core-utils bumped from ^0.17.0 to ^0.18.0 + +## [0.6.0](https://www.github.com/ipfs/js-ipfs/compare/ipfs-core-config-v0.5.1...ipfs-core-config-v0.6.0) (2022-10-24) + + +### ⚠ BREAKING CHANGES + +* ipfs is now bundled with libp2p@0.40.x which has different config + +### Features + +* upgrade libp2p to 0.40.x ([#4237](https://www.github.com/ipfs/js-ipfs/issues/4237)) ([0cee4a4](https://www.github.com/ipfs/js-ipfs/commit/0cee4a4c55767022584dcbade0b0b9b43326f9c9)) + + +### Dependencies + +* The following workspace dependencies were updated + * devDependencies + * ipfs-core-utils bumped from ^0.16.1 to ^0.17.0 + ### [0.5.1](https://www.github.com/ipfs/js-ipfs/compare/ipfs-core-config-v0.5.0...ipfs-core-config-v0.5.1) (2022-09-21) diff --git a/packages/ipfs-core-config/README.md b/packages/ipfs-core-config/README.md index 14218e9c74..272cb0e329 100644 --- a/packages/ipfs-core-config/README.md +++ b/packages/ipfs-core-config/README.md @@ -1,10 +1,9 @@ # ipfs-core-config -[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io) -[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) -[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs) +[![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech) +[![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech) [![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs) -[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/js-test-and-release.yml) +[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/js-ipfs/test.yml?branch=master\&style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/test.yml?query=branch%3Amaster) > Package to store node and browser specific config for ipfs-core diff --git a/packages/ipfs-core-config/package.json b/packages/ipfs-core-config/package.json index ce76cd7e38..c61f13a98c 100644 --- a/packages/ipfs-core-config/package.json +++ b/packages/ipfs-core-config/package.json @@ -1,6 +1,6 @@ { "name": "ipfs-core-config", - "version": "0.5.1", + "version": "0.7.0", "description": "Package to store node and browser specific config for ipfs-core", "author": "Alex Potsides ", "license": "Apache-2.0 OR MIT", @@ -94,30 +94,31 @@ "build": "aegir build" }, "dependencies": { - "@chainsafe/libp2p-gossipsub": "^4.0.0", - "@libp2p/floodsub": "^3.0.0", - "@libp2p/logger": "^2.0.0", - "@libp2p/mdns": "^3.0.0", - "@libp2p/tcp": "^3.0.1", - "@libp2p/webrtc-star": "^3.0.0", - "blockstore-datastore-adapter": "^3.0.0", + "@chainsafe/libp2p-gossipsub": "^6.0.0", + "@libp2p/floodsub": "^6.0.0", + "@libp2p/logger": "^2.0.5", + "@libp2p/mdns": "^6.0.0", + "@libp2p/prometheus-metrics": "^1.0.1", + "@libp2p/tcp": "^6.0.2", + "@libp2p/webrtc-star": "^6.0.0", + "blockstore-datastore-adapter": "^5.0.0", "datastore-core": "^8.0.1", "datastore-fs": "^8.0.0", "datastore-level": "^9.0.0", "err-code": "^3.0.1", "hashlru": "^2.3.0", "interface-datastore": "^7.0.0", - "ipfs-repo": "^15.0.3", - "ipfs-utils": "^9.0.6", - "is-ipfs": "^7.0.0", - "it-all": "^1.0.4", - "it-drain": "^1.0.3", - "it-foreach": "^0.1.1", + "ipfs-repo": "^17.0.0", + "ipfs-utils": "^9.0.13", + "is-ipfs": "^8.0.0", + "it-all": "^2.0.0", + "it-drain": "^2.0.0", + "it-foreach": "^1.0.0", "p-queue": "^7.2.0", - "uint8arrays": "^3.0.0" + "uint8arrays": "^4.0.2" }, "devDependencies": { - "aegir": "^37.0.11", - "ipfs-core-utils": "^0.16.1" + "aegir": "^37.11.0", + "ipfs-core-utils": "^0.18.0" } } diff --git a/packages/ipfs-core-config/src/libp2p-pubsub-routers.browser.js b/packages/ipfs-core-config/src/libp2p-pubsub-routers.browser.js index d2749def9a..99fce4374b 100644 --- a/packages/ipfs-core-config/src/libp2p-pubsub-routers.browser.js +++ b/packages/ipfs-core-config/src/libp2p-pubsub-routers.browser.js @@ -1,11 +1,10 @@ -import { GossipSub } from '@chainsafe/libp2p-gossipsub' +import { gossipsub } from '@chainsafe/libp2p-gossipsub' /** @typedef {import('@libp2p/interface-pubsub').PubSub} PubSub */ -/** @type {() => Record}>} */ +/** @type {() => Record PubSub>}>} */ export const routers = () => ({ - gossipsub: new GossipSub({ - allowPublishToZeroPeers: true, + gossipsub: gossipsub({ fallbackToFloodsub: true, emitSelf: true, maxInboundStreams: 64, diff --git a/packages/ipfs-core-config/src/libp2p-pubsub-routers.js b/packages/ipfs-core-config/src/libp2p-pubsub-routers.js index b21da2882a..c67c71f99d 100644 --- a/packages/ipfs-core-config/src/libp2p-pubsub-routers.js +++ b/packages/ipfs-core-config/src/libp2p-pubsub-routers.js @@ -1,18 +1,17 @@ -import { GossipSub } from '@chainsafe/libp2p-gossipsub' -import { FloodSub } from '@libp2p/floodsub' +import { gossipsub } from '@chainsafe/libp2p-gossipsub' +import { floodsub } from '@libp2p/floodsub' /** @typedef {import('@libp2p/interface-pubsub').PubSub} PubSub */ -/** @type {() => Record}>} */ +/** @type {() => Record PubSub>}>} */ export const routers = () => ({ - gossipsub: new GossipSub({ - allowPublishToZeroPeers: true, + gossipsub: gossipsub({ fallbackToFloodsub: true, emitSelf: true, maxInboundStreams: 64, maxOutboundStreams: 128 }), - floodsub: new FloodSub({ + floodsub: floodsub({ emitSelf: true }) }) diff --git a/packages/ipfs-core-config/src/libp2p.browser.js b/packages/ipfs-core-config/src/libp2p.browser.js index 59de391ffd..9241c0e7b2 100644 --- a/packages/ipfs-core-config/src/libp2p.browser.js +++ b/packages/ipfs-core-config/src/libp2p.browser.js @@ -1,12 +1,12 @@ -import { WebRTCStar } from '@libp2p/webrtc-star' +import { webRTCStar } from '@libp2p/webrtc-star' export function libp2pConfig () { - const webRtcStar = new WebRTCStar() + const webRtcStar = webRTCStar() /** @type {import('libp2p').Libp2pOptions} */ const options = { transports: [ - webRtcStar + webRtcStar.transport ], peerDiscovery: [ webRtcStar.discovery @@ -19,9 +19,6 @@ export function libp2pConfig () { }, nat: { enabled: false - }, - metrics: { - enabled: true } } diff --git a/packages/ipfs-core-config/src/libp2p.js b/packages/ipfs-core-config/src/libp2p.js index 57032303da..66498e6d61 100644 --- a/packages/ipfs-core-config/src/libp2p.js +++ b/packages/ipfs-core-config/src/libp2p.js @@ -1,15 +1,16 @@ -import { TCP } from '@libp2p/tcp' -import { MulticastDNS } from '@libp2p/mdns' +import { tcp } from '@libp2p/tcp' +import { mdns } from '@libp2p/mdns' import os from 'os' +import { prometheusMetrics } from '@libp2p/prometheus-metrics' export function libp2pConfig () { /** @type {import('libp2p').Libp2pOptions} */ const options = { transports: [ - new TCP() + tcp() ], peerDiscovery: [ - new MulticastDNS() + mdns() ], connectionManager: { maxParallelDials: 150, // 150 total parallel multiaddr dials @@ -20,11 +21,12 @@ export function libp2pConfig () { nat: { enabled: true, description: `ipfs@${os.hostname()}` - }, - metrics: { - enabled: true } } + if (process.env.IPFS_MONITORING != null) { + options.metrics = prometheusMetrics() + } + return options } diff --git a/packages/ipfs-core-types/CHANGELOG.md b/packages/ipfs-core-types/CHANGELOG.md index dfa468ea55..bfb010663c 100644 --- a/packages/ipfs-core-types/CHANGELOG.md +++ b/packages/ipfs-core-types/CHANGELOG.md @@ -4,6 +4,29 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.14.0](https://www.github.com/ipfs/js-ipfs/compare/ipfs-core-types-v0.13.0...ipfs-core-types-v0.14.0) (2023-01-11) + + +### ⚠ BREAKING CHANGES + +* update multiformats to v11.x.x and related depenendcies (#4277) + +### Bug Fixes + +* update multiformats to v11.x.x and related depenendcies ([#4277](https://www.github.com/ipfs/js-ipfs/issues/4277)) ([521c84a](https://www.github.com/ipfs/js-ipfs/commit/521c84a958b04d61702577a5adce28519c1b2a3b)) +* use aegir to publish RCs ([#4284](https://www.github.com/ipfs/js-ipfs/issues/4284)) ([6d90cbf](https://www.github.com/ipfs/js-ipfs/commit/6d90cbf321a7dbf4b1084ba20f0c514dc08d8d0a)) + +## [0.13.0](https://www.github.com/ipfs/js-ipfs/compare/ipfs-core-types-v0.12.1...ipfs-core-types-v0.13.0) (2022-10-24) + + +### ⚠ BREAKING CHANGES + +* ipfs is now bundled with libp2p@0.40.x which has different config + +### Features + +* upgrade libp2p to 0.40.x ([#4237](https://www.github.com/ipfs/js-ipfs/issues/4237)) ([0cee4a4](https://www.github.com/ipfs/js-ipfs/commit/0cee4a4c55767022584dcbade0b0b9b43326f9c9)) + ### [0.12.1](https://www.github.com/ipfs/js-ipfs/compare/ipfs-core-types-v0.12.0...ipfs-core-types-v0.12.1) (2022-09-21) diff --git a/packages/ipfs-core-types/README.md b/packages/ipfs-core-types/README.md index 74084e05de..e2fb8e7c15 100644 --- a/packages/ipfs-core-types/README.md +++ b/packages/ipfs-core-types/README.md @@ -1,10 +1,9 @@ # ipfs-core-types -[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io) -[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) -[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs) +[![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech) +[![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech) [![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs) -[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/js-test-and-release.yml) +[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/js-ipfs/test.yml?branch=master\&style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/test.yml?query=branch%3Amaster) > IPFS interface definitions used by implementations for API compatibility. diff --git a/packages/ipfs-core-types/package.json b/packages/ipfs-core-types/package.json index 7a5daf7c69..738b7e2907 100644 --- a/packages/ipfs-core-types/package.json +++ b/packages/ipfs-core-types/package.json @@ -1,6 +1,6 @@ { "name": "ipfs-core-types", - "version": "0.12.1", + "version": "0.14.0", "description": "IPFS interface definitions used by implementations for API compatibility.", "license": "Apache-2.0 OR MIT", "homepage": "https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-core-types#readme", @@ -25,7 +25,7 @@ "types": "./dist/src/index.d.ts", "files": [ "src", - "dist/src", + "dist", "!dist/test", "!**/*.tsbuildinfo" ], @@ -47,18 +47,18 @@ "build": "aegir build" }, "dependencies": { - "@ipld/dag-pb": "^2.1.3", - "@libp2p/interface-keychain": "^1.0.3", - "@libp2p/interface-peer-id": "^1.0.4", + "@ipld/dag-pb": "^4.0.0", + "@libp2p/interface-keychain": "^2.0.0", + "@libp2p/interface-peer-id": "^2.0.0", "@libp2p/interface-peer-info": "^1.0.2", - "@libp2p/interface-pubsub": "^2.0.0", - "@multiformats/multiaddr": "^11.0.0", + "@libp2p/interface-pubsub": "^3.0.0", + "@multiformats/multiaddr": "^11.1.5", "@types/node": "^18.0.0", "interface-datastore": "^7.0.0", - "ipfs-unixfs": "^7.0.0", - "multiformats": "^9.5.1" + "ipfs-unixfs": "^9.0.0", + "multiformats": "^11.0.0" }, "devDependencies": { - "aegir": "^37.0.11" + "aegir": "^37.11.0" } } diff --git a/packages/ipfs-core-types/src/block/index.ts b/packages/ipfs-core-types/src/block/index.ts index 9872bec152..5b0c7a9cef 100644 --- a/packages/ipfs-core-types/src/block/index.ts +++ b/packages/ipfs-core-types/src/block/index.ts @@ -1,5 +1,5 @@ import type { AbortOptions, PreloadOptions } from '../utils' -import type { CID, CIDVersion } from 'multiformats/cid' +import type { CID, Version as CIDVersion } from 'multiformats/cid' export interface API { /** diff --git a/packages/ipfs-core-types/src/dag/index.ts b/packages/ipfs-core-types/src/dag/index.ts index 875ea131cc..116ee95b33 100644 --- a/packages/ipfs-core-types/src/dag/index.ts +++ b/packages/ipfs-core-types/src/dag/index.ts @@ -1,5 +1,5 @@ import type { AbortOptions, PreloadOptions, IPFSPath } from '../utils' -import type { CID, CIDVersion } from 'multiformats/cid' +import type { CID, Version as CIDVersion } from 'multiformats/cid' export interface API { /** diff --git a/packages/ipfs-core-types/src/files/index.ts b/packages/ipfs-core-types/src/files/index.ts index c30f59334f..d64614a74a 100644 --- a/packages/ipfs-core-types/src/files/index.ts +++ b/packages/ipfs-core-types/src/files/index.ts @@ -1,5 +1,5 @@ import type { AbortOptions, IPFSPath } from '../utils' -import type { CID, CIDVersion } from 'multiformats/cid' +import type { CID, Version as CIDVersion } from 'multiformats/cid' import type { Mtime, MtimeLike } from 'ipfs-unixfs' import type { AddProgressFn } from '../root' diff --git a/packages/ipfs-core-types/src/root.ts b/packages/ipfs-core-types/src/root.ts index a761e201c2..c12ad0e832 100644 --- a/packages/ipfs-core-types/src/root.ts +++ b/packages/ipfs-core-types/src/root.ts @@ -1,5 +1,5 @@ import type { AbortOptions, PreloadOptions, IPFSPath, ImportCandidateStream, ImportCandidate } from './utils' -import type { CID, CIDVersion } from 'multiformats/cid' +import type { CID, Version as CIDVersion } from 'multiformats/cid' import type { Mtime } from 'ipfs-unixfs' import type { Multiaddr } from '@multiformats/multiaddr' import type { PeerId } from '@libp2p/interface-peer-id' diff --git a/packages/ipfs-core-utils/CHANGELOG.md b/packages/ipfs-core-utils/CHANGELOG.md index 214f070458..573c91d766 100644 --- a/packages/ipfs-core-utils/CHANGELOG.md +++ b/packages/ipfs-core-utils/CHANGELOG.md @@ -4,6 +4,43 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.18.0](https://www.github.com/ipfs/js-ipfs/compare/ipfs-core-utils-v0.17.0...ipfs-core-utils-v0.18.0) (2023-01-11) + + +### ⚠ BREAKING CHANGES + +* update multiformats to v11.x.x and related depenendcies (#4277) + +### Bug Fixes + +* update multiformats to v11.x.x and related depenendcies ([#4277](https://www.github.com/ipfs/js-ipfs/issues/4277)) ([521c84a](https://www.github.com/ipfs/js-ipfs/commit/521c84a958b04d61702577a5adce28519c1b2a3b)) +* use aegir to publish RCs ([#4284](https://www.github.com/ipfs/js-ipfs/issues/4284)) ([6d90cbf](https://www.github.com/ipfs/js-ipfs/commit/6d90cbf321a7dbf4b1084ba20f0c514dc08d8d0a)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * ipfs-core-types bumped from ^0.13.0 to ^0.14.0 + +## [0.17.0](https://www.github.com/ipfs/js-ipfs/compare/ipfs-core-utils-v0.16.1...ipfs-core-utils-v0.17.0) (2022-10-24) + + +### ⚠ BREAKING CHANGES + +* ipfs is now bundled with libp2p@0.40.x which has different config + +### Features + +* upgrade libp2p to 0.40.x ([#4237](https://www.github.com/ipfs/js-ipfs/issues/4237)) ([0cee4a4](https://www.github.com/ipfs/js-ipfs/commit/0cee4a4c55767022584dcbade0b0b9b43326f9c9)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * ipfs-core-types bumped from ^0.12.1 to ^0.13.0 + ### [0.16.1](https://www.github.com/ipfs/js-ipfs/compare/ipfs-core-utils-v0.16.0...ipfs-core-utils-v0.16.1) (2022-09-21) diff --git a/packages/ipfs-core-utils/README.md b/packages/ipfs-core-utils/README.md index 5a3d3c05b4..0e8264bd03 100644 --- a/packages/ipfs-core-utils/README.md +++ b/packages/ipfs-core-utils/README.md @@ -1,16 +1,16 @@ # ipfs-core-utils -[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io) -[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) -[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs) +[![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech) +[![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech) [![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs) -[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/js-test-and-release.yml) +[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/js-ipfs/test.yml?branch=master\&style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/test.yml?query=branch%3Amaster) > Package to share code between ipfs and ipfs-http-client ## Table of contents - [Install](#install) + - [Browser ` +``` + ## License Licensed under either of diff --git a/packages/ipfs-core-utils/package.json b/packages/ipfs-core-utils/package.json index 9fb748860d..af2451492c 100644 --- a/packages/ipfs-core-utils/package.json +++ b/packages/ipfs-core-utils/package.json @@ -1,6 +1,6 @@ { "name": "ipfs-core-utils", - "version": "0.16.1", + "version": "0.18.0", "description": "Package to share code between ipfs and ipfs-http-client", "author": "Alex Potsides ", "license": "Apache-2.0 OR MIT", @@ -140,30 +140,30 @@ "build": "aegir build" }, "dependencies": { - "@libp2p/logger": "^2.0.0", - "@multiformats/multiaddr": "^11.0.0", + "@libp2p/logger": "^2.0.5", + "@multiformats/multiaddr": "^11.1.5", "@multiformats/multiaddr-to-uri": "^9.0.1", "any-signal": "^3.0.0", - "blob-to-it": "^1.0.1", - "browser-readablestream-to-it": "^1.0.1", + "blob-to-it": "^2.0.0", + "browser-readablestream-to-it": "^2.0.0", "err-code": "^3.0.1", - "ipfs-core-types": "^0.12.1", - "ipfs-unixfs": "^7.0.0", - "ipfs-utils": "^9.0.6", - "it-all": "^1.0.4", - "it-map": "^1.0.6", - "it-peekable": "^1.0.2", + "ipfs-core-types": "^0.14.0", + "ipfs-unixfs": "^9.0.0", + "ipfs-utils": "^9.0.13", + "it-all": "^2.0.0", + "it-map": "^2.0.0", + "it-peekable": "^2.0.0", "it-to-stream": "^1.0.0", "merge-options": "^3.0.4", - "multiformats": "^9.5.1", + "multiformats": "^11.0.0", "nanoid": "^4.0.0", "parse-duration": "^1.0.0", "timeout-abort-controller": "^3.0.0", - "uint8arrays": "^3.0.0" + "uint8arrays": "^4.0.2" }, "devDependencies": { "@web-std/file": "^3.0.2", - "aegir": "^37.0.11" + "aegir": "^37.11.0" }, "browser": { "fs": false diff --git a/packages/ipfs-core-utils/src/files/normalise-candidate-single.js b/packages/ipfs-core-utils/src/files/normalise-candidate-single.js index 1616cde954..9be8814101 100644 --- a/packages/ipfs-core-utils/src/files/normalise-candidate-single.js +++ b/packages/ipfs-core-utils/src/files/normalise-candidate-single.js @@ -49,7 +49,6 @@ export async function * normaliseCandidateSingle (input, normaliseContent) { // Iterable if (Symbol.iterator in input || Symbol.asyncIterator in input) { - // @ts-expect-error it's (async)iterable const peekable = itPeekable(input) /** @type {any} value **/ diff --git a/packages/ipfs-core-utils/src/pins/normalise-input.js b/packages/ipfs-core-utils/src/pins/normalise-input.js index feef80f43c..3675f53ca6 100644 --- a/packages/ipfs-core-utils/src/pins/normalise-input.js +++ b/packages/ipfs-core-utils/src/pins/normalise-input.js @@ -17,6 +17,30 @@ import { CID } from 'multiformats/cid' * @property {any} [metadata] */ +/** + * @param {any} thing + * @returns {thing is IterableIterator & Iterator} + */ +function isIterable (thing) { + return Symbol.iterator in thing +} + +/** + * @param {any} thing + * @returns {thing is AsyncIterableIterator & AsyncIterator} + */ +function isAsyncIterable (thing) { + return Symbol.asyncIterator in thing +} + +/** + * @param {any} thing + * @returns {thing is CID} + */ +function isCID (thing) { + return CID.asCID(thing) != null +} + /** * Transform one of: * @@ -71,14 +95,16 @@ export async function * normaliseInput (input) { } // Iterable - if (Symbol.iterator in input) { - // @ts-expect-error + if (isIterable(input)) { const iterator = input[Symbol.iterator]() const first = iterator.next() - if (first.done) return iterator - // Iterable - if (CID.asCID(first.value) || first.value instanceof String || typeof first.value === 'string') { + if (first.done) { + return iterator + } + + // Iterable + if (isCID(first.value)) { yield toPin({ cid: first.value }) for (const cid of iterator) { yield toPin({ cid }) @@ -86,7 +112,16 @@ export async function * normaliseInput (input) { return } - // Iterable<{ cid: CID recursive, metadata }> + // Iterable + if (first.value instanceof String || typeof first.value === 'string') { + yield toPin({ path: first.value }) + for (const path of iterator) { + yield toPin({ path }) + } + return + } + + // Iterable if (first.value.cid != null || first.value.path != null) { yield toPin(first.value) for (const obj of iterator) { @@ -99,14 +134,13 @@ export async function * normaliseInput (input) { } // AsyncIterable - if (Symbol.asyncIterator in input) { - // @ts-expect-error + if (isAsyncIterable(input)) { const iterator = input[Symbol.asyncIterator]() const first = await iterator.next() if (first.done) return iterator - // AsyncIterable - if (CID.asCID(first.value) || first.value instanceof String || typeof first.value === 'string') { + // AsyncIterable + if (isCID(first.value)) { yield toPin({ cid: first.value }) for await (const cid of iterator) { yield toPin({ cid }) @@ -114,6 +148,15 @@ export async function * normaliseInput (input) { return } + // AsyncIterable + if (first.value instanceof String || typeof first.value === 'string') { + yield toPin({ path: first.value }) + for await (const path of iterator) { + yield toPin({ path }) + } + return + } + // AsyncIterable<{ cid: CID|String recursive, metadata }> if (first.value.cid != null || first.value.path != null) { yield toPin(first.value) diff --git a/packages/ipfs-core/.aegir.js b/packages/ipfs-core/.aegir.js index e54714d714..5e37662ad7 100644 --- a/packages/ipfs-core/.aegir.js +++ b/packages/ipfs-core/.aegir.js @@ -6,17 +6,7 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url)) /** @type {import('aegir').Options["build"]["config"]} */ const esbuild = { - inject: [path.join(__dirname, '../../scripts/node-globals.js')], - plugins: [ - { - name: 'node built ins', - setup (build) { - build.onResolve({ filter: /^stream$/ }, () => { - return { path: require.resolve('readable-stream') } - }) - } - } - ] + inject: [path.join(__dirname, '../../scripts/node-globals.js')] } /** @type {import('aegir').PartialOptions} */ diff --git a/packages/ipfs-core/CHANGELOG.md b/packages/ipfs-core/CHANGELOG.md index 0964a5d648..4b7ef3e523 100644 --- a/packages/ipfs-core/CHANGELOG.md +++ b/packages/ipfs-core/CHANGELOG.md @@ -3,6 +3,62 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.18.0](https://www.github.com/ipfs/js-ipfs/compare/ipfs-core-v0.17.0...ipfs-core-v0.18.0) (2023-01-11) + + +### ⚠ BREAKING CHANGES + +* update multiformats to v11.x.x and related depenendcies (#4277) + +### Bug Fixes + +* allow reading rawLeaves in MFS ([#4282](https://www.github.com/ipfs/js-ipfs/issues/4282)) ([0cfcaf6](https://www.github.com/ipfs/js-ipfs/commit/0cfcaf65998bdc2af0cc29ac48229bb3bc35c5b8)) +* mfs blob import for files larger than 262144b ([#4251](https://www.github.com/ipfs/js-ipfs/issues/4251)) ([6be5906](https://www.github.com/ipfs/js-ipfs/commit/6be59068cc99c517526bfa123ad475ae05fcbaef)), closes [#3601](https://www.github.com/ipfs/js-ipfs/issues/3601) [#3576](https://www.github.com/ipfs/js-ipfs/issues/3576) +* update multiformats to v11.x.x and related depenendcies ([#4277](https://www.github.com/ipfs/js-ipfs/issues/4277)) ([521c84a](https://www.github.com/ipfs/js-ipfs/commit/521c84a958b04d61702577a5adce28519c1b2a3b)) +* use aegir to publish RCs ([#4284](https://www.github.com/ipfs/js-ipfs/issues/4284)) ([6d90cbf](https://www.github.com/ipfs/js-ipfs/commit/6d90cbf321a7dbf4b1084ba20f0c514dc08d8d0a)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * ipfs-core-config bumped from ^0.6.0 to ^0.7.0 + * ipfs-core-types bumped from ^0.13.0 to ^0.14.0 + * ipfs-core-utils bumped from ^0.17.0 to ^0.18.0 + * ipfs-http-client bumped from ^59.0.0 to ^60.0.0 + * devDependencies + * interface-ipfs-core bumped from ^0.157.0 to ^0.158.0 + +## [0.17.0](https://www.github.com/ipfs/js-ipfs/compare/ipfs-core-v0.16.1...ipfs-core-v0.17.0) (2022-10-24) + + +### ⚠ BREAKING CHANGES + +* ipfs is now bundled with libp2p@0.40.x which has different config +* require IPNS V2 signatures (#4207) + +### Features + +* upgrade libp2p to 0.40.x ([#4237](https://www.github.com/ipfs/js-ipfs/issues/4237)) ([0cee4a4](https://www.github.com/ipfs/js-ipfs/commit/0cee4a4c55767022584dcbade0b0b9b43326f9c9)) + + +### Bug Fixes + +* replace slice with subarray for increased performance ([#4210](https://www.github.com/ipfs/js-ipfs/issues/4210)) ([dfc43d4](https://www.github.com/ipfs/js-ipfs/commit/dfc43d4e9be67fdf25553677f469379d966ff806)) +* require IPNS V2 signatures ([#4207](https://www.github.com/ipfs/js-ipfs/issues/4207)) ([d1b0a8a](https://www.github.com/ipfs/js-ipfs/commit/d1b0a8a71073b4ece0dbda5a5405d76dd8d5b358)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * ipfs-core-config bumped from ^0.5.1 to ^0.6.0 + * ipfs-core-types bumped from ^0.12.1 to ^0.13.0 + * ipfs-core-utils bumped from ^0.16.1 to ^0.17.0 + * ipfs-http-client bumped from ^58.0.1 to ^59.0.0 + * devDependencies + * interface-ipfs-core bumped from ^0.156.1 to ^0.157.0 + ### [0.16.1](https://www.github.com/ipfs/js-ipfs/compare/ipfs-core-v0.16.0...ipfs-core-v0.16.1) (2022-09-21) diff --git a/packages/ipfs-core/README.md b/packages/ipfs-core/README.md index d690536b65..d617decaeb 100644 --- a/packages/ipfs-core/README.md +++ b/packages/ipfs-core/README.md @@ -1,16 +1,16 @@ # ipfs-core -[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io) -[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) -[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs) +[![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech) +[![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech) [![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs) -[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/js-test-and-release.yml) +[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/js-ipfs/test.yml?branch=master\&style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/test.yml?query=branch%3Amaster) > JavaScript implementation of the IPFS specification ## Table of contents - - [Install](#install) + - [Browser ` +``` +

IPFS in JavaScript logo diff --git a/packages/ipfs-core/package.json b/packages/ipfs-core/package.json index 0b889bb92f..2a2547f54f 100644 --- a/packages/ipfs-core/package.json +++ b/packages/ipfs-core/package.json @@ -1,6 +1,6 @@ { "name": "ipfs-core", - "version": "0.16.1", + "version": "0.18.0", "description": "JavaScript implementation of the IPFS specification", "license": "Apache-2.0 OR MIT", "homepage": "https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-core#readme", @@ -74,96 +74,97 @@ "dep-check": "aegir dep-check -i interface-ipfs-core -i ipfs-core-types --i interface-blockstore -i @libp2p/interface-dht -i @libp2p/interface-keys -i @libp2p/interface-transport -i @libp2p/interfaces" }, "dependencies": { - "@chainsafe/libp2p-noise": "^8.0.0", - "@ipld/car": "^4.1.0", - "@ipld/dag-cbor": "^7.0.0", - "@ipld/dag-json": "^8.0.1", - "@ipld/dag-pb": "^2.1.3", - "@libp2p/bootstrap": "^2.0.0", - "@libp2p/crypto": "^1.0.0", - "@libp2p/delegated-content-routing": "^2.0.1", - "@libp2p/delegated-peer-routing": "^2.0.1", - "@libp2p/interface-dht": "^1.0.1", - "@libp2p/interface-keys": "^1.0.3", - "@libp2p/interface-peer-id": "^1.0.4", - "@libp2p/interface-transport": "^1.0.2", - "@libp2p/interfaces": "^3.0.3", - "@libp2p/kad-dht": "^3.0.0", - "@libp2p/logger": "^2.0.0", - "@libp2p/mplex": "^5.2.0", - "@libp2p/peer-id": "^1.1.10", - "@libp2p/peer-id-factory": "^1.0.10", - "@libp2p/record": "^2.0.0", - "@libp2p/websockets": "^3.0.0", + "@chainsafe/libp2p-noise": "^11.0.0", + "@ipld/car": "^5.0.0", + "@ipld/dag-cbor": "^9.0.0", + "@ipld/dag-json": "^10.0.0", + "@ipld/dag-pb": "^4.0.0", + "@libp2p/bootstrap": "^6.0.0", + "@libp2p/crypto": "^1.0.7", + "@libp2p/delegated-content-routing": "^4.0.0", + "@libp2p/delegated-peer-routing": "^4.0.0", + "@libp2p/interface-dht": "^2.0.0", + "@libp2p/interface-keys": "^1.0.6", + "@libp2p/interface-peer-id": "^2.0.0", + "@libp2p/interface-transport": "^2.1.0", + "@libp2p/interfaces": "^3.2.0", + "@libp2p/kad-dht": "^7.0.0", + "@libp2p/logger": "^2.0.5", + "@libp2p/mplex": "^7.1.1", + "@libp2p/peer-id": "^2.0.0", + "@libp2p/peer-id-factory": "^2.0.0", + "@libp2p/record": "^3.0.0", + "@libp2p/websockets": "^5.0.0", "@multiformats/mafmt": "^11.0.2", - "@multiformats/multiaddr": "^11.0.0", + "@multiformats/multiaddr": "^11.1.5", "@multiformats/multiaddr-to-uri": "^9.0.1", - "@multiformats/murmur3": "^1.1.1", + "@multiformats/murmur3": "^2.0.0", "any-signal": "^3.0.0", "array-shuffle": "^3.0.0", - "blockstore-core": "^2.0.1", - "dag-jose": "^2.0.1", + "blockstore-core": "^3.0.0", + "browser-readablestream-to-it": "^2.0.0", + "dag-jose": "^4.0.0", "datastore-core": "^8.0.1", - "datastore-pubsub": "^4.0.2", + "datastore-pubsub": "^7.0.0", "dlv": "^1.1.3", "err-code": "^3.0.1", "hamt-sharding": "^3.0.0", "hashlru": "^2.3.0", - "interface-blockstore": "^3.0.0", + "interface-blockstore": "^4.0.0", "interface-datastore": "^7.0.0", - "ipfs-bitswap": "^12.0.3", - "ipfs-core-config": "^0.5.1", - "ipfs-core-types": "^0.12.1", - "ipfs-core-utils": "^0.16.1", - "ipfs-http-client": "^58.0.1", - "ipfs-repo": "^15.0.3", - "ipfs-unixfs": "^7.0.0", - "ipfs-unixfs-exporter": "^8.0.6", - "ipfs-unixfs-importer": "^10.0.2", - "ipfs-utils": "^9.0.6", - "ipns": "^3.0.0", + "ipfs-bitswap": "^15.0.0", + "ipfs-core-config": "^0.7.0", + "ipfs-core-types": "^0.14.0", + "ipfs-core-utils": "^0.18.0", + "ipfs-http-client": "^60.0.0", + "ipfs-repo": "^17.0.0", + "ipfs-unixfs": "^9.0.0", + "ipfs-unixfs-exporter": "^10.0.0", + "ipfs-unixfs-importer": "^12.0.0", + "ipfs-utils": "^9.0.13", + "ipns": "^5.0.1", "is-domain-name": "^1.0.1", - "is-ipfs": "^7.0.0", - "it-drain": "^1.0.3", - "it-filter": "^1.0.2", - "it-first": "^1.0.6", - "it-last": "^1.0.4", - "it-map": "^1.0.6", - "it-merge": "^1.0.3", - "it-parallel": "^2.0.1", - "it-peekable": "^1.0.2", + "is-ipfs": "^8.0.0", + "it-drain": "^2.0.0", + "it-filter": "^2.0.0", + "it-first": "^2.0.0", + "it-last": "^2.0.0", + "it-map": "^2.0.0", + "it-merge": "^2.0.0", + "it-parallel": "^3.0.0", + "it-peekable": "^2.0.0", "it-pipe": "^2.0.3", "it-pushable": "^3.0.0", "it-tar": "^6.0.0", - "it-to-buffer": "^2.0.0", + "it-to-buffer": "^3.0.0", "just-safe-set": "^4.0.2", - "libp2p": "^0.39.2", + "libp2p": "^0.42.0", "merge-options": "^3.0.4", "mortice": "^3.0.0", - "multiformats": "^9.5.1", + "multiformats": "^11.0.0", "pako": "^2.0.4", "parse-duration": "^1.0.0", "timeout-abort-controller": "^3.0.0", - "uint8arrays": "^3.0.0" + "uint8arrays": "^4.0.2" }, "devDependencies": { - "@chainsafe/libp2p-gossipsub": "^4.0.0", + "@chainsafe/libp2p-gossipsub": "^6.0.0", "@types/dlv": "^1.1.2", "@types/pako": "^2.0.0", "@types/rimraf": "^3.0.1", - "aegir": "^37.0.11", - "blockstore-datastore-adapter": "^3.0.0", + "aegir": "^37.11.0", + "blockstore-datastore-adapter": "^5.0.0", "delay": "^5.0.0", - "go-ipfs": "^0.12.1", - "interface-blockstore-tests": "^3.0.0", - "interface-ipfs-core": "^0.156.1", - "ipfsd-ctl": "^12.0.3", + "go-ipfs": "^0.12.0", + "interface-blockstore-tests": "^4.0.0", + "interface-ipfs-core": "^0.158.0", + "ipfsd-ctl": "^13.0.0", "iso-url": "^1.0.0", - "it-all": "^1.0.4", + "it-all": "^2.0.0", "nanoid": "^4.0.0", "p-defer": "^4.0.0", "rimraf": "^3.0.2", - "sinon": "^14.0.0" + "sinon": "^15.0.1" }, "gitHead": "" } diff --git a/packages/ipfs-core/src/components/block/put.js b/packages/ipfs-core/src/components/block/put.js index 1066790f44..54566cdef7 100644 --- a/packages/ipfs-core/src/components/block/put.js +++ b/packages/ipfs-core/src/components/block/put.js @@ -2,7 +2,7 @@ import { CID } from 'multiformats/cid' import { withTimeoutOption } from 'ipfs-core-utils/with-timeout-option' /** - * @typedef {import('multiformats/cid').CIDVersion} CIDVersion + * @typedef {import('multiformats/cid').Version} CIDVersion */ /** diff --git a/packages/ipfs-core/src/components/dag/export.js b/packages/ipfs-core/src/components/dag/export.js index ad37aacb8a..5fc24ec7bc 100644 --- a/packages/ipfs-core/src/components/dag/export.js +++ b/packages/ipfs-core/src/components/dag/export.js @@ -25,7 +25,10 @@ const NO_LINKS_CODECS = [ /** * @template T - * @typedef {import('multiformats/block').Block} Block + * @template C + * @template A + * @template V + * @typedef {import('multiformats/block').Block} Block */ /** @@ -85,12 +88,11 @@ export function createExport ({ repo, preload, codecs }) { } /** - * @template T * @param {IPFSRepo} repo * @param {BlockWriter} writer * @param {AbortOptions} options * @param {import('ipfs-core-utils/multicodecs').Multicodecs} codecs - * @returns {(cid:CID)=>Promise|null>} + * @returns {(cid:CID)=>Promise|null>} */ function makeLoader (repo, writer, options, codecs) { return async (cid) => { diff --git a/packages/ipfs-core/src/components/files/chmod.js b/packages/ipfs-core/src/components/files/chmod.js index 76783e3c52..3806fd64f7 100644 --- a/packages/ipfs-core/src/components/files/chmod.js +++ b/packages/ipfs-core/src/components/files/chmod.js @@ -22,7 +22,7 @@ const mergeOptions = mergeOpts.bind({ ignoreUndefined: true }) const log = logger('ipfs:mfs:touch') /** - * @typedef {import('multiformats/cid').CIDVersion} CIDVersion + * @typedef {import('multiformats/cid').Version} CIDVersion * @typedef {import('@ipld/dag-pb').PBNode} PBNode * @typedef {import('./').MfsContext} MfsContext * diff --git a/packages/ipfs-core/src/components/files/cp.js b/packages/ipfs-core/src/components/files/cp.js index 607156c177..57b4ad88cb 100644 --- a/packages/ipfs-core/src/components/files/cp.js +++ b/packages/ipfs-core/src/components/files/cp.js @@ -16,7 +16,7 @@ const log = logger('ipfs:mfs:cp') /** * @typedef {import('@ipld/dag-pb').PBNode} DAGNode * @typedef {import('multiformats/cid').CID} CID - * @typedef {import('multiformats/cid').CIDVersion} CIDVersion + * @typedef {import('multiformats/cid').Version} CIDVersion * @typedef {import('ipfs-unixfs').Mtime} Mtime * @typedef {import('./utils/to-mfs-path').MfsPath} MfsPath * @typedef {import('./utils/to-trail').MfsTrail} MfsTrail diff --git a/packages/ipfs-core/src/components/files/mkdir.js b/packages/ipfs-core/src/components/files/mkdir.js index ec55f8e6e4..ec8164e992 100644 --- a/packages/ipfs-core/src/components/files/mkdir.js +++ b/packages/ipfs-core/src/components/files/mkdir.js @@ -16,7 +16,7 @@ const log = logger('ipfs:mfs:mkdir') /** * @typedef {import('@ipld/dag-pb').PBNode} PBNode * @typedef {import('multiformats/cid').CID} CID - * @typedef {import('multiformats/cid').CIDVersion} CIDVersion + * @typedef {import('multiformats/cid').Version} CIDVersion * @typedef {import('ipfs-unixfs').MtimeLike} MtimeLike * @typedef {import('./').MfsContext} MfsContext * @typedef {object} DefaultOptions diff --git a/packages/ipfs-core/src/components/files/mv.js b/packages/ipfs-core/src/components/files/mv.js index b972d251b4..1470b9d95e 100644 --- a/packages/ipfs-core/src/components/files/mv.js +++ b/packages/ipfs-core/src/components/files/mv.js @@ -6,7 +6,7 @@ import { withTimeoutOption } from 'ipfs-core-utils/with-timeout-option' const mergeOptions = mergeOpts.bind({ ignoreUndefined: true }) /** - * @typedef {import('multiformats/cid').CIDVersion} CIDVersion + * @typedef {import('multiformats/cid').Version} CIDVersion * @typedef {import('./').MfsContext} MfsContext * @typedef {object} DefaultOptions * @property {boolean} parents diff --git a/packages/ipfs-core/src/components/files/read.js b/packages/ipfs-core/src/components/files/read.js index a66ba0d78c..28b132f12c 100644 --- a/packages/ipfs-core/src/components/files/read.js +++ b/packages/ipfs-core/src/components/files/read.js @@ -39,8 +39,8 @@ export function createRead (context) { const mfsPath = await toMfsPath(context, path, options) const result = await exporter(mfsPath.mfsPath, context.repo.blocks) - if (result.type !== 'file') { - throw errCode(new Error(`${path} was not a file`), 'ERR_NOT_FILE') + if (result.type !== 'file' && result.type !== 'raw') { + throw errCode(new Error(`${path} was not a file or raw bytes`), 'ERR_NOT_FILE') } if (!result.content) { diff --git a/packages/ipfs-core/src/components/files/rm.js b/packages/ipfs-core/src/components/files/rm.js index 33d5cb5e43..6321cac958 100644 --- a/packages/ipfs-core/src/components/files/rm.js +++ b/packages/ipfs-core/src/components/files/rm.js @@ -10,7 +10,7 @@ import mergeOpts from 'merge-options' const mergeOptions = mergeOpts.bind({ ignoreUndefined: true }) /** - * @typedef {import('multiformats/cid').CIDVersion} CIDVersion + * @typedef {import('multiformats/cid').Version} CIDVersion * @typedef {import('./').MfsContext} MfsContext * @typedef {object} DefaultOptions * @property {boolean} recursive diff --git a/packages/ipfs-core/src/components/files/touch.js b/packages/ipfs-core/src/components/files/touch.js index 41d5f6fba2..5530b9dd89 100644 --- a/packages/ipfs-core/src/components/files/touch.js +++ b/packages/ipfs-core/src/components/files/touch.js @@ -15,7 +15,7 @@ const mergeOptions = mergeOpts.bind({ ignoreUndefined: true }) const log = logger('ipfs:mfs:touch') /** - * @typedef {import('multiformats/cid').CIDVersion} CIDVersion + * @typedef {import('multiformats/cid').Version} CIDVersion * @typedef {import('ipfs-unixfs').MtimeLike} MtimeLike * @typedef {import('./').MfsContext} MfsContext * @typedef {object} DefaultOptions diff --git a/packages/ipfs-core/src/components/files/utils/add-link.js b/packages/ipfs-core/src/components/files/utils/add-link.js index 60a2772aea..7c1e16da7d 100644 --- a/packages/ipfs-core/src/components/files/utils/add-link.js +++ b/packages/ipfs-core/src/components/files/utils/add-link.js @@ -18,7 +18,7 @@ const log = logger('ipfs:mfs:core:utils:add-link') /** * @typedef {import('ipfs-unixfs').Mtime} Mtime - * @typedef {import('multiformats/cid').CIDVersion} CIDVersion + * @typedef {import('multiformats/cid').Version} CIDVersion * @typedef {import('hamt-sharding').Bucket} Bucket * @typedef {import('../').MfsContext} MfsContext * @typedef {import('@ipld/dag-pb').PBNode} PBNode diff --git a/packages/ipfs-core/src/components/files/utils/create-node.js b/packages/ipfs-core/src/components/files/utils/create-node.js index 09250a6e59..c2ff579f6c 100644 --- a/packages/ipfs-core/src/components/files/utils/create-node.js +++ b/packages/ipfs-core/src/components/files/utils/create-node.js @@ -4,7 +4,7 @@ import { CID } from 'multiformats/cid' /** * @typedef {import('ipfs-unixfs').MtimeLike} MtimeLike - * @typedef {import('multiformats/cid').CIDVersion} CIDVersion + * @typedef {import('multiformats/cid').Version} CIDVersion * @typedef {import('../').MfsContext} MfsContext */ diff --git a/packages/ipfs-core/src/components/files/utils/dir-sharded.js b/packages/ipfs-core/src/components/files/utils/dir-sharded.js index 81cd48043b..32a7511393 100644 --- a/packages/ipfs-core/src/components/files/utils/dir-sharded.js +++ b/packages/ipfs-core/src/components/files/utils/dir-sharded.js @@ -27,7 +27,7 @@ import { * @property {Mtime} [mtime] * @property {number} [mode] * @property {import('multiformats/codecs/interface').BlockCodec} [codec] - * @property {import('multiformats/cid').CIDVersion} [cidVersion] + * @property {import('multiformats/cid').Version} [cidVersion] * @property {boolean} [onlyHash] * @property {AbortSignal} [signal] */ diff --git a/packages/ipfs-core/src/components/files/utils/hamt-utils.js b/packages/ipfs-core/src/components/files/utils/hamt-utils.js index f70907678d..e31940ca46 100644 --- a/packages/ipfs-core/src/components/files/utils/hamt-utils.js +++ b/packages/ipfs-core/src/components/files/utils/hamt-utils.js @@ -17,7 +17,7 @@ import { const log = logger('ipfs:mfs:core:utils:hamt-utils') /** - * @typedef {import('multiformats/cid').CIDVersion} CIDVersion + * @typedef {import('multiformats/cid').Version} CIDVersion * @typedef {import('ipfs-unixfs').Mtime} Mtime * @typedef {import('../').MfsContext} MfsContext * @typedef {import('@ipld/dag-pb').PBNode} PBNode diff --git a/packages/ipfs-core/src/components/files/utils/persist.js b/packages/ipfs-core/src/components/files/utils/persist.js index 0d8c6bbcc9..5617683655 100644 --- a/packages/ipfs-core/src/components/files/utils/persist.js +++ b/packages/ipfs-core/src/components/files/utils/persist.js @@ -6,7 +6,7 @@ import { sha256 } from 'multiformats/hashes/sha2' * @typedef {object} PersistOptions * @property {import('multiformats/codecs/interface').BlockCodec} [codec] * @property {import('multiformats/hashes/interface').MultihashHasher} [hasher] - * @property {import('multiformats/cid').CIDVersion} [cidVersion] + * @property {import('multiformats/cid').Version} [cidVersion] * @property {boolean} [onlyHash] * @property {AbortSignal} [signal] */ diff --git a/packages/ipfs-core/src/components/files/utils/remove-link.js b/packages/ipfs-core/src/components/files/utils/remove-link.js index 104cff1fa4..0d81494a48 100644 --- a/packages/ipfs-core/src/components/files/utils/remove-link.js +++ b/packages/ipfs-core/src/components/files/utils/remove-link.js @@ -13,7 +13,7 @@ const log = logger('ipfs:mfs:core:utils:remove-link') /** * @typedef {import('../').MfsContext} MfsContext - * @typedef {import('multiformats/cid').CIDVersion} CIDVersion + * @typedef {import('multiformats/cid').Version} CIDVersion * @typedef {import('hamt-sharding').Bucket} Bucket * @typedef {import('@ipld/dag-pb').PBNode} PBNode * diff --git a/packages/ipfs-core/src/components/files/utils/to-async-iterator.js b/packages/ipfs-core/src/components/files/utils/to-async-iterator.js index 06f7a9ee5c..219b959a19 100644 --- a/packages/ipfs-core/src/components/files/utils/to-async-iterator.js +++ b/packages/ipfs-core/src/components/files/utils/to-async-iterator.js @@ -1,9 +1,7 @@ import errCode from 'err-code' import { logger } from '@libp2p/logger' -import { - MFS_MAX_CHUNK_SIZE -} from '../../../utils.js' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' +import browserStreamToIt from 'browser-readablestream-to-it' const log = logger('ipfs:mfs:utils:to-async-iterator') @@ -44,52 +42,7 @@ export function toAsyncIterator (content) { if (global.Blob && content instanceof global.Blob) { // HTML5 Blob objects (including Files) log('Content was an HTML5 Blob') - - let index = 0 - - const iterator = { - next: () => { - if (index > content.size) { - return { - done: true - } - } - - return new Promise((resolve, reject) => { - const chunk = content.slice(index, MFS_MAX_CHUNK_SIZE) - index += MFS_MAX_CHUNK_SIZE - - const reader = new global.FileReader() - - /** - * @param {{ error?: Error }} ev - */ - const handleLoad = (ev) => { - // @ts-expect-error No overload matches this call. - reader.removeEventListener('loadend', handleLoad, false) - - if (ev.error) { - return reject(ev.error) - } - - resolve({ - done: false, - value: new Uint8Array(/** @type {ArrayBuffer} */(reader.result)) - }) - } - - // @ts-expect-error No overload matches this call. - reader.addEventListener('loadend', handleLoad) - reader.readAsArrayBuffer(chunk) - }) - } - } - - return { - [Symbol.asyncIterator]: () => { - return iterator - } - } + return browserStreamToIt(content.stream()) } throw errCode(new Error(`Don't know how to convert ${content} into an async iterator`), 'ERR_INVALID_PARAMS') diff --git a/packages/ipfs-core/src/components/files/utils/update-tree.js b/packages/ipfs-core/src/components/files/utils/update-tree.js index 26af608e75..eb504332a1 100644 --- a/packages/ipfs-core/src/components/files/utils/update-tree.js +++ b/packages/ipfs-core/src/components/files/utils/update-tree.js @@ -12,7 +12,7 @@ const defaultOptions = { /** * @typedef {import('multiformats/cid').CID} CID - * @typedef {import('multiformats/cid').CIDVersion} CIDVersion + * @typedef {import('multiformats/cid').Version} CIDVersion * @typedef {import('../').MfsContext} MfsContext * @typedef {import('./to-trail').MfsTrail} MfsTrail */ diff --git a/packages/ipfs-core/src/components/files/write.js b/packages/ipfs-core/src/components/files/write.js index 9e81518b39..3bca1e99fa 100644 --- a/packages/ipfs-core/src/components/files/write.js +++ b/packages/ipfs-core/src/components/files/write.js @@ -29,7 +29,7 @@ const mergeOptions = mergeOpts.bind({ ignoreUndefined: true }) const log = logger('ipfs:mfs:write') /** - * @typedef {import('multiformats/cid').CIDVersion} CIDVersion + * @typedef {import('multiformats/cid').Version} CIDVersion * @typedef {import('ipfs-unixfs').MtimeLike} MtimeLike * @typedef {import('./').MfsContext} MfsContext * @typedef {import('./utils/to-mfs-path').FilePath} FilePath diff --git a/packages/ipfs-core/src/components/libp2p.js b/packages/ipfs-core/src/components/libp2p.js index 3ca9c8517b..337399ccd9 100644 --- a/packages/ipfs-core/src/components/libp2p.js +++ b/packages/ipfs-core/src/components/libp2p.js @@ -2,20 +2,20 @@ import get from 'dlv' import mergeOpts from 'merge-options' import errCode from 'err-code' import { routers } from 'ipfs-core-config/libp2p-pubsub-routers' -import { DelegatedPeerRouting } from '@libp2p/delegated-peer-routing' -import { DelegatedContentRouting } from '@libp2p/delegated-content-routing' +import { delegatedPeerRouting } from '@libp2p/delegated-peer-routing' +import { delegatedContentRouting } from '@libp2p/delegated-content-routing' import { create as ipfsHttpClient } from 'ipfs-http-client' import { multiaddr } from '@multiformats/multiaddr' import { ipfsCore as pkgversion } from '../version.js' import { libp2pConfig as getEnvLibp2pOptions } from 'ipfs-core-config/libp2p' import { createLibp2p as createNode } from 'libp2p' -import { KadDHT } from '@libp2p/kad-dht' -import { Bootstrap } from '@libp2p/bootstrap' +import { kadDHT } from '@libp2p/kad-dht' +import { bootstrap } from '@libp2p/bootstrap' import { ipnsValidator } from 'ipns/validator' import { ipnsSelector } from 'ipns/selector' -import { WebSockets } from '@libp2p/websockets' -import { Mplex } from '@libp2p/mplex' -import { Noise } from '@chainsafe/libp2p-noise' +import { webSockets } from '@libp2p/websockets' +import { mplex } from '@libp2p/mplex' +import { noise } from '@chainsafe/libp2p-noise' const mergeOptions = mergeOpts.bind({ ignoreUndefined: true, concatArrays: true }) @@ -71,6 +71,9 @@ export function createLibp2p ({ return options.libp2p({ libp2pOptions, options, config, datastore, peerId }) } + // do not start by default + libp2pOptions.start = false + return createNode(libp2pOptions) } @@ -125,13 +128,13 @@ function getLibp2pOptions ({ options, config, datastore, keychainConfig, peerId, peerDiscovery: [], transports: [], streamMuxers: [ - new Mplex({ + mplex({ maxInboundStreams: 256, maxOutboundStreams: 1024 }) ], connectionEncryption: [ - new Noise() + noise() ], relay: { enabled: get(options, 'relay.enabled', get(config, 'relay.enabled', true)), @@ -150,7 +153,7 @@ function getLibp2pOptions ({ options, config, datastore, keychainConfig, peerId, } if (get(config, 'Routing.Type', 'dhtclient') !== 'none') { - libp2pOptions.dht = new KadDHT({ + libp2pOptions.dht = kadDHT({ clientMode: get(config, 'Routing.Type', 'dht') !== 'dhtserver', kBucketSize: get(options, 'dht.kBucketSize', 20), validators: { @@ -166,7 +169,7 @@ function getLibp2pOptions ({ options, config, datastore, keychainConfig, peerId, if (boostrapNodes.length > 0) { libp2pOptions.peerDiscovery?.push( - new Bootstrap({ + bootstrap({ list: boostrapNodes }) ) @@ -207,13 +210,20 @@ function getLibp2pOptions ({ options, config, datastore, keychainConfig, peerId, const delegateHttpClient = ipfsHttpClient(delegateApiOptions) - libp2pFinalConfig.contentRouters?.push(new DelegatedContentRouting(delegateHttpClient)) - libp2pFinalConfig.peerRouters?.push(new DelegatedPeerRouting(delegateHttpClient)) + libp2pFinalConfig.contentRouters?.push(delegatedContentRouting(delegateHttpClient)) + libp2pFinalConfig.peerRouters?.push(delegatedPeerRouting(delegateHttpClient)) } + // TODO: fixme if (!get(options, 'config.Discovery.MDNS.Enabled', get(config, 'Discovery.MDNS.Enabled', true))) { libp2pFinalConfig.peerDiscovery = libp2pFinalConfig.peerDiscovery?.filter(d => { - return d != null && d[Symbol.toStringTag] !== '@libp2p/mdns' + try { + if (typeof d === 'function') { + // @ts-expect-error not components + return d({})[Symbol.toStringTag] !== '@libp2p/mdns' + } + } catch {} + return true }) } @@ -222,8 +232,15 @@ function getLibp2pOptions ({ options, config, datastore, keychainConfig, peerId, } // add WebSocket transport if not overridden by user config - if (libp2pFinalConfig.transports.find(t => t[Symbol.toStringTag] === '@libp2p/websockets') == null) { - libp2pFinalConfig.transports.push(new WebSockets()) + if (libp2pFinalConfig.transports.find(t => { + try { + if (typeof t === 'function') { + return t({})[Symbol.toStringTag] === '@libp2p/websockets' + } + } catch {} + return false + }) == null) { + libp2pFinalConfig.transports.push(webSockets()) } return libp2pFinalConfig diff --git a/packages/ipfs-core/src/components/stats/bw.js b/packages/ipfs-core/src/components/stats/bw.js index 01d97044d8..82f6b2ea34 100644 --- a/packages/ipfs-core/src/components/stats/bw.js +++ b/packages/ipfs-core/src/components/stats/bw.js @@ -16,6 +16,7 @@ import { withTimeoutOption } from 'ipfs-core-utils/with-timeout-option' * @returns {BandwidthInfo} */ function getBandwidthStats (libp2p, opts) { +/* let stats if (!libp2p.metrics) { @@ -27,16 +28,16 @@ function getBandwidthStats (libp2p, opts) { } else { stats = libp2p.metrics.getGlobal() } - - if (!stats) { - return { - totalIn: BigInt(0), - totalOut: BigInt(0), - rateIn: 0.0, - rateOut: 0.0 - } +*/ + // if (!stats) { + return { + totalIn: BigInt(0), + totalOut: BigInt(0), + rateIn: 0.0, + rateOut: 0.0 } - + // } +/* const movingAverages = stats.getMovingAverages() const snapshot = stats.getSnapshot() @@ -46,6 +47,7 @@ function getBandwidthStats (libp2p, opts) { rateIn: movingAverages.dataReceived[60000].movingAverage / 60, rateOut: movingAverages.dataSent[60000].movingAverage / 60 } +*/ } /** diff --git a/packages/ipfs-core/test/utils/create-node.js b/packages/ipfs-core/test/utils/create-node.js index 703ccac267..71345eb725 100644 --- a/packages/ipfs-core/test/utils/create-node.js +++ b/packages/ipfs-core/test/utils/create-node.js @@ -26,7 +26,8 @@ export default async (config = {}) => { repo, config: { Addresses: { - Swarm: [] + Swarm: [], + Delegates: [] }, Bootstrap: [] }, diff --git a/packages/ipfs-daemon/CHANGELOG.md b/packages/ipfs-daemon/CHANGELOG.md index 9739a51ab0..9670f1da2a 100644 --- a/packages/ipfs-daemon/CHANGELOG.md +++ b/packages/ipfs-daemon/CHANGELOG.md @@ -3,6 +3,51 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.16.0](https://www.github.com/ipfs/js-ipfs/compare/ipfs-daemon-v0.15.0...ipfs-daemon-v0.16.0) (2023-01-11) + + +### ⚠ BREAKING CHANGES + +* update multiformats to v11.x.x and related depenendcies (#4277) + +### Bug Fixes + +* update multiformats to v11.x.x and related depenendcies ([#4277](https://www.github.com/ipfs/js-ipfs/issues/4277)) ([521c84a](https://www.github.com/ipfs/js-ipfs/commit/521c84a958b04d61702577a5adce28519c1b2a3b)) +* use aegir to publish RCs ([#4284](https://www.github.com/ipfs/js-ipfs/issues/4284)) ([6d90cbf](https://www.github.com/ipfs/js-ipfs/commit/6d90cbf321a7dbf4b1084ba20f0c514dc08d8d0a)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * ipfs-core bumped from ^0.17.0 to ^0.18.0 + * ipfs-core-types bumped from ^0.13.0 to ^0.14.0 + * ipfs-grpc-server bumped from ^0.11.0 to ^0.12.0 + * ipfs-http-gateway bumped from ^0.12.0 to ^0.13.0 + * ipfs-http-server bumped from ^0.14.0 to ^0.15.0 + +## [0.15.0](https://www.github.com/ipfs/js-ipfs/compare/ipfs-daemon-v0.14.2...ipfs-daemon-v0.15.0) (2022-10-24) + + +### ⚠ BREAKING CHANGES + +* ipfs is now bundled with libp2p@0.40.x which has different config + +### Features + +* upgrade libp2p to 0.40.x ([#4237](https://www.github.com/ipfs/js-ipfs/issues/4237)) ([0cee4a4](https://www.github.com/ipfs/js-ipfs/commit/0cee4a4c55767022584dcbade0b0b9b43326f9c9)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * ipfs-core bumped from ^0.16.1 to ^0.17.0 + * ipfs-core-types bumped from ^0.12.1 to ^0.13.0 + * ipfs-grpc-server bumped from ^0.10.1 to ^0.11.0 + * ipfs-http-gateway bumped from ^0.11.1 to ^0.12.0 + * ipfs-http-server bumped from ^0.13.2 to ^0.14.0 + ### [0.14.2](https://www.github.com/ipfs/js-ipfs/compare/ipfs-daemon-v0.14.1...ipfs-daemon-v0.14.2) (2022-09-21) diff --git a/packages/ipfs-daemon/README.md b/packages/ipfs-daemon/README.md index bff80307a2..4b33747691 100644 --- a/packages/ipfs-daemon/README.md +++ b/packages/ipfs-daemon/README.md @@ -1,10 +1,9 @@ # ipfs-daemon -[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io) -[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) -[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs) +[![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech) +[![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech) [![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs) -[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/js-test-and-release.yml) +[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/js-ipfs/test.yml?branch=master\&style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/test.yml?query=branch%3Amaster) > JavaScript implementation of the IPFS specification diff --git a/packages/ipfs-daemon/package.json b/packages/ipfs-daemon/package.json index 32c9cd255c..b2fb72517e 100644 --- a/packages/ipfs-daemon/package.json +++ b/packages/ipfs-daemon/package.json @@ -1,6 +1,6 @@ { "name": "ipfs-daemon", - "version": "0.14.2", + "version": "0.16.0", "description": "JavaScript implementation of the IPFS specification", "license": "Apache-2.0 OR MIT", "homepage": "https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-daemon#readme", @@ -63,19 +63,19 @@ "build": "aegir build --no-bundle" }, "dependencies": { - "@libp2p/logger": "^2.0.0", - "@libp2p/webrtc-star": "^3.0.0", + "@libp2p/logger": "^2.0.5", + "@libp2p/webrtc-star": "^6.0.0", "@mapbox/node-pre-gyp": "^1.0.5", - "ipfs-core": "^0.16.1", - "ipfs-core-types": "^0.12.1", - "ipfs-grpc-server": "^0.10.1", - "ipfs-http-gateway": "^0.11.1", - "ipfs-http-server": "^0.13.2", - "ipfs-utils": "^9.0.6", - "libp2p": "^0.39.2" + "ipfs-core": "^0.18.0", + "ipfs-core-types": "^0.14.0", + "ipfs-grpc-server": "^0.12.0", + "ipfs-http-gateway": "^0.13.0", + "ipfs-http-server": "^0.15.0", + "ipfs-utils": "^9.0.13", + "libp2p": "^0.42.0" }, "devDependencies": { - "aegir": "^37.0.11", + "aegir": "^37.11.0", "node-fetch": "^3.2.3", "ws": "^8.5.0" }, diff --git a/packages/ipfs-daemon/src/index.js b/packages/ipfs-daemon/src/index.js index 5ccbe80093..13f3251557 100644 --- a/packages/ipfs-daemon/src/index.js +++ b/packages/ipfs-daemon/src/index.js @@ -1,11 +1,10 @@ import { logger } from '@libp2p/logger' -import { WebRTCStar } from '@libp2p/webrtc-star' +import { webRTCStar } from '@libp2p/webrtc-star' import { create } from 'ipfs-core' import { HttpApi } from 'ipfs-http-server' import { HttpGateway } from 'ipfs-http-gateway' import { createServer as gRPCServer } from 'ipfs-grpc-server' import { isElectron } from 'ipfs-utils/src/env.js' -import prometheusClient from 'prom-client' import { createLibp2p } from 'libp2p' const log = logger('ipfs:daemon') @@ -17,11 +16,6 @@ export class Daemon { constructor (options = {}) { this._options = options - if (process.env.IPFS_MONITORING) { - // Setup debug metrics collection - prometheusClient.collectDefaultMetrics() - } - /** @type {import('ipfs-core-types').IPFS} */ // @ts-expect-error we set this in .start() this._ipfs = undefined @@ -97,11 +91,11 @@ async function getLibp2p ({ libp2pOptions }) { if (wrtc || electronWebRTC) { log(`Using ${wrtc ? 'wrtc' : 'electron-webrtc'} for webrtc support`) - const transport = new WebRTCStar({ + const transport = webRTCStar({ wrtc: wrtc ?? electronWebRTC }) - libp2pOptions.transports = [...libp2pOptions.transports ?? [], transport] + libp2pOptions.transports = [...libp2pOptions.transports ?? [], transport.transport] libp2pOptions.peerDiscovery = [...libp2pOptions.peerDiscovery ?? [], transport.discovery] } diff --git a/packages/ipfs-grpc-client/CHANGELOG.md b/packages/ipfs-grpc-client/CHANGELOG.md index fc85d455bb..2e2da0559d 100644 --- a/packages/ipfs-grpc-client/CHANGELOG.md +++ b/packages/ipfs-grpc-client/CHANGELOG.md @@ -4,6 +4,46 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.13.0](https://www.github.com/ipfs/js-ipfs/compare/ipfs-grpc-client-v0.12.0...ipfs-grpc-client-v0.13.0) (2023-01-11) + + +### ⚠ BREAKING CHANGES + +* update multiformats to v11.x.x and related depenendcies (#4277) + +### Bug Fixes + +* update multiformats to v11.x.x and related depenendcies ([#4277](https://www.github.com/ipfs/js-ipfs/issues/4277)) ([521c84a](https://www.github.com/ipfs/js-ipfs/commit/521c84a958b04d61702577a5adce28519c1b2a3b)) +* use aegir to publish RCs ([#4284](https://www.github.com/ipfs/js-ipfs/issues/4284)) ([6d90cbf](https://www.github.com/ipfs/js-ipfs/commit/6d90cbf321a7dbf4b1084ba20f0c514dc08d8d0a)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * ipfs-core-types bumped from ^0.13.0 to ^0.14.0 + * ipfs-core-utils bumped from ^0.17.0 to ^0.18.0 + * ipfs-grpc-protocol bumped from ^0.7.0 to ^0.8.0 + +## [0.12.0](https://www.github.com/ipfs/js-ipfs/compare/ipfs-grpc-client-v0.11.1...ipfs-grpc-client-v0.12.0) (2022-10-24) + + +### ⚠ BREAKING CHANGES + +* ipfs is now bundled with libp2p@0.40.x which has different config + +### Features + +* upgrade libp2p to 0.40.x ([#4237](https://www.github.com/ipfs/js-ipfs/issues/4237)) ([0cee4a4](https://www.github.com/ipfs/js-ipfs/commit/0cee4a4c55767022584dcbade0b0b9b43326f9c9)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * ipfs-core-types bumped from ^0.12.1 to ^0.13.0 + * ipfs-core-utils bumped from ^0.16.1 to ^0.17.0 + ### [0.11.1](https://www.github.com/ipfs/js-ipfs/compare/ipfs-grpc-client-v0.11.0...ipfs-grpc-client-v0.11.1) (2022-09-21) diff --git a/packages/ipfs-grpc-client/README.md b/packages/ipfs-grpc-client/README.md index dc0af12833..0912f358b4 100644 --- a/packages/ipfs-grpc-client/README.md +++ b/packages/ipfs-grpc-client/README.md @@ -1,16 +1,16 @@ # ipfs-grpc-client -[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io) -[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) -[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs) +[![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech) +[![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech) [![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs) -[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/js-test-and-release.yml) +[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/js-ipfs/test.yml?branch=master\&style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/test.yml?query=branch%3Amaster) > A client library for the IPFS gRPC API ## Table of contents - [Install](#install) + - [Browser ` +``` + This module implements part of the [IPFS Core API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) using gRPC over websockets to achieve the bidirectional streaming necessary to have full duplex streams running in the browser. It's not recommended you use this directly, instead use the [ipfs-client](https://www.npmjs.com/package/ipfs-client) to combine this with the [ipfs-http-client](https://www.npmjs.com/package/ipfs-http-client) in order to have HTTP fallback for the missing parts of the API. diff --git a/packages/ipfs-grpc-client/package.json b/packages/ipfs-grpc-client/package.json index 0978bfc1fe..0435b66a15 100644 --- a/packages/ipfs-grpc-client/package.json +++ b/packages/ipfs-grpc-client/package.json @@ -1,6 +1,6 @@ { "name": "ipfs-grpc-client", - "version": "0.11.1", + "version": "0.13.0", "description": "A client library for the IPFS gRPC API", "license": "Apache-2.0 OR MIT", "homepage": "https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-grpc-client#readme", @@ -69,29 +69,29 @@ }, "dependencies": { "@improbable-eng/grpc-web": "^0.15.0", - "@libp2p/logger": "^2.0.0", - "@libp2p/peer-id": "^1.1.10", - "@multiformats/multiaddr": "^11.0.0", + "@libp2p/logger": "^2.0.5", + "@libp2p/peer-id": "^2.0.0", + "@multiformats/multiaddr": "^11.1.5", "change-case": "^4.1.1", "err-code": "^3.0.1", - "ipfs-core-types": "^0.12.1", - "ipfs-core-utils": "^0.16.1", - "ipfs-grpc-protocol": "^0.7.0", - "ipfs-unixfs": "^7.0.0", - "it-first": "^1.0.6", + "ipfs-core-types": "^0.14.0", + "ipfs-core-utils": "^0.18.0", + "ipfs-grpc-protocol": "^0.8.0", + "ipfs-unixfs": "^9.0.0", + "it-first": "^2.0.0", "it-pushable": "^3.0.0", - "multiformats": "^9.5.1", + "multiformats": "^11.0.0", "p-defer": "^4.0.0", "protobufjs": "^7.0.0", - "uint8arrays": "^3.0.0", + "uint8arrays": "^4.0.2", "wherearewe": "^2.0.1", "ws": "^8.5.0" }, "devDependencies": { - "aegir": "^37.0.11", - "it-all": "^1.0.4", + "aegir": "^37.11.0", + "it-all": "^2.0.0", "protobufjs-cli": "^1.0.0", - "sinon": "^14.0.0" + "sinon": "^15.0.1" }, "browser": { "./src/grpc/transport.js": "./src/grpc/transport.browser.js", diff --git a/packages/ipfs-grpc-protocol/CHANGELOG.md b/packages/ipfs-grpc-protocol/CHANGELOG.md index b589a006d5..b0b5823591 100644 --- a/packages/ipfs-grpc-protocol/CHANGELOG.md +++ b/packages/ipfs-grpc-protocol/CHANGELOG.md @@ -3,6 +3,18 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.8.0](https://www.github.com/ipfs/js-ipfs/compare/ipfs-grpc-protocol-v0.7.0...ipfs-grpc-protocol-v0.8.0) (2023-01-11) + + +### ⚠ BREAKING CHANGES + +* update multiformats to v11.x.x and related depenendcies (#4277) + +### Bug Fixes + +* update multiformats to v11.x.x and related depenendcies ([#4277](https://www.github.com/ipfs/js-ipfs/issues/4277)) ([521c84a](https://www.github.com/ipfs/js-ipfs/commit/521c84a958b04d61702577a5adce28519c1b2a3b)) +* use aegir to publish RCs ([#4284](https://www.github.com/ipfs/js-ipfs/issues/4284)) ([6d90cbf](https://www.github.com/ipfs/js-ipfs/commit/6d90cbf321a7dbf4b1084ba20f0c514dc08d8d0a)) + ## [0.7.0](https://www.github.com/ipfs/js-ipfs/compare/ipfs-grpc-protocol-v0.6.0...ipfs-grpc-protocol-v0.7.0) (2022-09-06) diff --git a/packages/ipfs-grpc-protocol/README.md b/packages/ipfs-grpc-protocol/README.md index cb1a259a93..8713893aa0 100644 --- a/packages/ipfs-grpc-protocol/README.md +++ b/packages/ipfs-grpc-protocol/README.md @@ -1,10 +1,9 @@ # ipfs-grpc-protocol -[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io) -[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) -[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs) +[![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech) +[![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech) [![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs) -[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/js-test-and-release.yml) +[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/js-ipfs/test.yml?branch=master\&style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/test.yml?query=branch%3Amaster) > Protobuf definitions for the IPFS gRPC API diff --git a/packages/ipfs-grpc-protocol/package.json b/packages/ipfs-grpc-protocol/package.json index 2da554a4c4..52d745e1a4 100644 --- a/packages/ipfs-grpc-protocol/package.json +++ b/packages/ipfs-grpc-protocol/package.json @@ -1,6 +1,6 @@ { "name": "ipfs-grpc-protocol", - "version": "0.7.0", + "version": "0.8.0", "description": "Protobuf definitions for the IPFS gRPC API", "license": "Apache-2.0 OR MIT", "homepage": "https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-grpc-protocol#readme", @@ -60,7 +60,7 @@ "lint": "aegir lint" }, "devDependencies": { - "aegir": "^37.0.11", + "aegir": "^37.11.0", "mkdirp": "^1.0.4", "protobufjs": "^7.0.0", "protobufjs-cli": "^1.0.0" diff --git a/packages/ipfs-grpc-server/CHANGELOG.md b/packages/ipfs-grpc-server/CHANGELOG.md index 87e48c8716..d8444e244f 100644 --- a/packages/ipfs-grpc-server/CHANGELOG.md +++ b/packages/ipfs-grpc-server/CHANGELOG.md @@ -4,6 +4,53 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.12.0](https://www.github.com/ipfs/js-ipfs/compare/ipfs-grpc-server-v0.11.0...ipfs-grpc-server-v0.12.0) (2023-01-11) + + +### ⚠ BREAKING CHANGES + +* update multiformats to v11.x.x and related depenendcies (#4277) + +### Bug Fixes + +* update multiformats to v11.x.x and related depenendcies ([#4277](https://www.github.com/ipfs/js-ipfs/issues/4277)) ([521c84a](https://www.github.com/ipfs/js-ipfs/commit/521c84a958b04d61702577a5adce28519c1b2a3b)) +* use aegir to publish RCs ([#4284](https://www.github.com/ipfs/js-ipfs/issues/4284)) ([6d90cbf](https://www.github.com/ipfs/js-ipfs/commit/6d90cbf321a7dbf4b1084ba20f0c514dc08d8d0a)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * ipfs-core-types bumped from ^0.13.0 to ^0.14.0 + * ipfs-grpc-protocol bumped from ^0.7.0 to ^0.8.0 + * devDependencies + * ipfs-core bumped from ^0.17.0 to ^0.18.0 + +## [0.11.0](https://www.github.com/ipfs/js-ipfs/compare/ipfs-grpc-server-v0.10.1...ipfs-grpc-server-v0.11.0) (2022-10-24) + + +### ⚠ BREAKING CHANGES + +* ipfs is now bundled with libp2p@0.40.x which has different config + +### Features + +* upgrade libp2p to 0.40.x ([#4237](https://www.github.com/ipfs/js-ipfs/issues/4237)) ([0cee4a4](https://www.github.com/ipfs/js-ipfs/commit/0cee4a4c55767022584dcbade0b0b9b43326f9c9)) + + +### Bug Fixes + +* replace slice with subarray for increased performance ([#4210](https://www.github.com/ipfs/js-ipfs/issues/4210)) ([dfc43d4](https://www.github.com/ipfs/js-ipfs/commit/dfc43d4e9be67fdf25553677f469379d966ff806)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * ipfs-core-types bumped from ^0.12.1 to ^0.13.0 + * devDependencies + * ipfs-core bumped from ^0.16.1 to ^0.17.0 + ### [0.10.1](https://www.github.com/ipfs/js-ipfs/compare/ipfs-grpc-server-v0.10.0...ipfs-grpc-server-v0.10.1) (2022-09-21) diff --git a/packages/ipfs-grpc-server/README.md b/packages/ipfs-grpc-server/README.md index 8cf92e355b..288c11a227 100644 --- a/packages/ipfs-grpc-server/README.md +++ b/packages/ipfs-grpc-server/README.md @@ -1,10 +1,9 @@ # ipfs-grpc-server -[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io) -[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) -[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs) +[![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech) +[![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech) [![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs) -[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/js-test-and-release.yml) +[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/js-ipfs/test.yml?branch=master\&style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/test.yml?query=branch%3Amaster) > A server library for the IPFS gRPC API diff --git a/packages/ipfs-grpc-server/package.json b/packages/ipfs-grpc-server/package.json index 1f8fe443fd..f3c9bcba83 100644 --- a/packages/ipfs-grpc-server/package.json +++ b/packages/ipfs-grpc-server/package.json @@ -1,6 +1,6 @@ { "name": "ipfs-grpc-server", - "version": "0.10.1", + "version": "0.12.0", "description": "A server library for the IPFS gRPC API", "license": "Apache-2.0 OR MIT", "homepage": "https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-grpc-server#readme", @@ -64,29 +64,29 @@ }, "dependencies": { "@grpc/grpc-js": "^1.1.8", - "@libp2p/logger": "^2.0.0", - "@libp2p/peer-id": "^1.1.10", - "@multiformats/multiaddr": "^11.0.0", + "@libp2p/logger": "^2.0.5", + "@libp2p/peer-id": "^2.0.0", + "@multiformats/multiaddr": "^11.1.5", "change-case": "^4.1.1", "coercer": "^1.1.2", - "ipfs-core-types": "^0.12.1", - "ipfs-grpc-protocol": "^0.7.0", - "it-first": "^1.0.6", - "it-map": "^1.0.6", - "it-peekable": "^1.0.2", + "ipfs-core-types": "^0.14.0", + "ipfs-grpc-protocol": "^0.8.0", + "it-first": "^2.0.0", + "it-map": "^2.0.0", + "it-peekable": "^2.0.0", "it-pipe": "^2.0.3", "it-pushable": "^3.0.0", "nanoid": "^4.0.0", "protobufjs": "^7.0.0", - "uint8arrays": "^3.0.0", + "uint8arrays": "^4.0.2", "ws": "^8.5.0" }, "devDependencies": { "@types/ws": "^8.5.3", - "aegir": "^37.0.11", - "ipfs-core": "^0.16.1", - "it-all": "^1.0.4", - "it-drain": "^1.0.3", - "sinon": "^14.0.0" + "aegir": "^37.11.0", + "ipfs-core": "^0.18.0", + "it-all": "^2.0.0", + "it-drain": "^2.0.0", + "sinon": "^15.0.1" } } diff --git a/packages/ipfs-http-client/CHANGELOG.md b/packages/ipfs-http-client/CHANGELOG.md index 9306c543d0..2d80f89662 100644 --- a/packages/ipfs-http-client/CHANGELOG.md +++ b/packages/ipfs-http-client/CHANGELOG.md @@ -4,6 +4,45 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [60.0.0](https://www.github.com/ipfs/js-ipfs/compare/ipfs-http-client-v59.0.0...ipfs-http-client-v60.0.0) (2023-01-11) + + +### ⚠ BREAKING CHANGES + +* update multiformats to v11.x.x and related depenendcies (#4277) + +### Bug Fixes + +* update multiformats to v11.x.x and related depenendcies ([#4277](https://www.github.com/ipfs/js-ipfs/issues/4277)) ([521c84a](https://www.github.com/ipfs/js-ipfs/commit/521c84a958b04d61702577a5adce28519c1b2a3b)) +* use aegir to publish RCs ([#4284](https://www.github.com/ipfs/js-ipfs/issues/4284)) ([6d90cbf](https://www.github.com/ipfs/js-ipfs/commit/6d90cbf321a7dbf4b1084ba20f0c514dc08d8d0a)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * ipfs-core-types bumped from ^0.13.0 to ^0.14.0 + * ipfs-core-utils bumped from ^0.17.0 to ^0.18.0 + +## [59.0.0](https://www.github.com/ipfs/js-ipfs/compare/ipfs-http-client-v58.0.1...ipfs-http-client-v59.0.0) (2022-10-24) + + +### ⚠ BREAKING CHANGES + +* ipfs is now bundled with libp2p@0.40.x which has different config + +### Features + +* upgrade libp2p to 0.40.x ([#4237](https://www.github.com/ipfs/js-ipfs/issues/4237)) ([0cee4a4](https://www.github.com/ipfs/js-ipfs/commit/0cee4a4c55767022584dcbade0b0b9b43326f9c9)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * ipfs-core-types bumped from ^0.12.1 to ^0.13.0 + * ipfs-core-utils bumped from ^0.16.1 to ^0.17.0 + ### [58.0.1](https://www.github.com/ipfs/js-ipfs/compare/ipfs-http-client-v58.0.0...ipfs-http-client-v58.0.1) (2022-09-21) diff --git a/packages/ipfs-http-client/README.md b/packages/ipfs-http-client/README.md index 0b4d457a45..36f7d1be01 100644 --- a/packages/ipfs-http-client/README.md +++ b/packages/ipfs-http-client/README.md @@ -1,16 +1,19 @@ # ipfs-http-client -[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io) -[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) -[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs) +[![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech) +[![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech) [![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs) -[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/js-test-and-release.yml) +[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/js-ipfs/test.yml?branch=master\&style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/test.yml?query=branch%3Amaster) -> A client library for the IPFS HTTP API +> A client library for the [IPFS HTTP API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) exposed by js-ipfs. + + +> Note: The client library for the [Kubo RPC API](https://docs.ipfs.tech/reference/kubo/rpc/) has moved into [js-kubo-rpc-client](https://github.com/ipfs/js-kubo-rpc-client). ## Table of contents - [Install](#install) + - [Browser ` +``` +

IPFS http client lib logo

-

The JavaScript HTTP RPC API client library for IPFS implementations.

+

The JavaScript HTTP RPC API client library for js-ipfs.

-

diff --git a/packages/ipfs-http-client/package.json b/packages/ipfs-http-client/package.json index 42ba926c9c..382ee68c22 100644 --- a/packages/ipfs-http-client/package.json +++ b/packages/ipfs-http-client/package.json @@ -1,6 +1,6 @@ { "name": "ipfs-http-client", - "version": "58.0.1", + "version": "60.0.0", "description": "A client library for the IPFS HTTP API", "license": "Apache-2.0 OR MIT", "homepage": "https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-http-client#readme", @@ -67,33 +67,33 @@ "dep-check": "aegir dep-check -i ipfs-core -i ipfs-core-types" }, "dependencies": { - "@ipld/dag-cbor": "^7.0.0", - "@ipld/dag-json": "^8.0.1", - "@ipld/dag-pb": "^2.1.3", - "@libp2p/logger": "^2.0.0", - "@libp2p/peer-id": "^1.1.10", - "@multiformats/multiaddr": "^11.0.0", + "@ipld/dag-cbor": "^9.0.0", + "@ipld/dag-json": "^10.0.0", + "@ipld/dag-pb": "^4.0.0", + "@libp2p/logger": "^2.0.5", + "@libp2p/peer-id": "^2.0.0", + "@multiformats/multiaddr": "^11.1.5", "any-signal": "^3.0.0", - "dag-jose": "^2.0.1", + "dag-jose": "^4.0.0", "err-code": "^3.0.1", - "ipfs-core-types": "^0.12.1", - "ipfs-core-utils": "^0.16.1", - "ipfs-utils": "^9.0.6", - "it-first": "^1.0.6", - "it-last": "^1.0.4", + "ipfs-core-types": "^0.14.0", + "ipfs-core-utils": "^0.18.0", + "ipfs-utils": "^9.0.13", + "it-first": "^2.0.0", + "it-last": "^2.0.0", "merge-options": "^3.0.4", - "multiformats": "^9.5.1", + "multiformats": "^11.0.0", "parse-duration": "^1.0.0", "stream-to-it": "^0.2.2", - "uint8arrays": "^3.0.0" + "uint8arrays": "^4.0.2" }, "devDependencies": { - "aegir": "^37.0.11", + "aegir": "^37.11.0", "delay": "^5.0.0", - "go-ipfs": "^0.12.1", - "ipfsd-ctl": "^12.0.3", - "it-all": "^1.0.4", - "it-first": "^1.0.4", + "go-ipfs": "^0.12.0", + "ipfsd-ctl": "^13.0.0", + "it-all": "^2.0.0", + "it-first": "^2.0.0", "nock": "^13.0.2", "p-defer": "^4.0.0" }, diff --git a/packages/ipfs-http-client/src/key/gen.js b/packages/ipfs-http-client/src/key/gen.js index 50a5e634fc..766a2d26b6 100644 --- a/packages/ipfs-http-client/src/key/gen.js +++ b/packages/ipfs-http-client/src/key/gen.js @@ -11,14 +11,16 @@ export const createGen = configure(api => { /** * @type {KeyAPI["gen"]} */ - async function gen (name, options = { type: 'Ed25519' }) { + async function gen (name, options) { + const opts = options ?? { type: 'Ed25519' } + const res = await api.post('key/gen', { - signal: options.signal, + signal: opts.signal, searchParams: toUrlSearchParams({ arg: name, - ...options + ...opts }), - headers: options.headers + headers: opts.headers }) const data = await res.json() diff --git a/packages/ipfs-http-client/test/node/agent.js b/packages/ipfs-http-client/test/node/agent.js index e85d3abfee..a080217102 100644 --- a/packages/ipfs-http-client/test/node/agent.js +++ b/packages/ipfs-http-client/test/node/agent.js @@ -35,7 +35,7 @@ function startServer (handler) { }) } -describe('agent', function () { +describe.skip('agent', function () { /** @type {import('http').Agent} */ let agent diff --git a/packages/ipfs-http-client/test/node/custom-headers.js b/packages/ipfs-http-client/test/node/custom-headers.js index 0932d6523b..33b7dda707 100644 --- a/packages/ipfs-http-client/test/node/custom-headers.js +++ b/packages/ipfs-http-client/test/node/custom-headers.js @@ -19,9 +19,9 @@ function startServer (fn) { res.writeHead(200) res.write(JSON.stringify({})) res.end() - server.close() - - headersResolve(req.headers) + server.close(() => { + headersResolve(req.headers) + }) }) }) diff --git a/packages/ipfs-http-client/test/node/request-api.js b/packages/ipfs-http-client/test/node/request-api.js index e67f19da25..38544eac3d 100644 --- a/packages/ipfs-http-client/test/node/request-api.js +++ b/packages/ipfs-http-client/test/node/request-api.js @@ -1,15 +1,31 @@ /* eslint-env mocha */ import { expect } from 'aegir/chai' -import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' import { create as httpClient } from '../../src/index.js' import http from 'http' describe('\'deal with HTTP weirdness\' tests', () => { + let server + + afterEach(async () => { + if (server != null) { + await new Promise((resolve, reject) => { + server.close((err) => { + if (err) { + reject(err) + return + } + + resolve() + }) + }) + } + }) + it('does not crash if no content-type header is provided', async function () { // go-ipfs always (currently) adds a content-type header, even if no content is present, // the standard behaviour for an http-api is to omit this header if no content is present - const server = http.createServer((req, res) => { + server = http.createServer((req, res) => { // Consume the entire request, before responding. req.on('data', () => {}) req.on('end', () => { @@ -20,15 +36,30 @@ describe('\'deal with HTTP weirdness\' tests', () => { await new Promise(resolve => server.listen(6001, resolve)) await httpClient('/ip4/127.0.0.1/tcp/6001').config.replace('test/fixtures/r-config.json') - - server.close() }) }) describe('trailer headers', () => { + let server + + afterEach(async () => { + if (server != null) { + await new Promise((resolve, reject) => { + server.close((err) => { + if (err) { + reject(err) + return + } + + resolve() + }) + }) + } + }) + // TODO: needs fixing https://github.com/ipfs/js-ipfs-http-client/pull/624#issuecomment-344181950 - it.skip('should deal with trailer x-stream-error correctly', (done) => { - const server = http.createServer((req, res) => { + it.skip('should deal with trailer x-stream-error correctly', async () => { + server = http.createServer((req, res) => { res.setHeader('x-chunked-output', '1') res.setHeader('content-type', 'application/json') res.setHeader('Trailer', 'X-Stream-Error') @@ -37,24 +68,34 @@ describe('trailer headers', () => { res.end() }) - server.listen(6001, () => { - const ipfs = httpClient('/ip4/127.0.0.1/tcp/6001') - /* eslint-disable */ - ipfs.add(uint8ArrayFromString('Hello there!'), (err, res) => { - // TODO: error's are not being correctly - // propagated with Trailer headers yet - // expect(err).to.exist() - expect(res).to.not.equal(0) - server.close(done) - }) - /* eslint-enable */ - }) + await new Promise(resolve => server.listen(6001, resolve)) + + // TODO: errors are not being correctly propagated with Trailer headers yet + // const ipfs = httpClient('/ip4/127.0.0.1/tcp/6001') + // await expect(ipfs.add(uint8ArrayFromString('Hello there!'))).to.eventually.be.rejected() }) }) describe('error handling', () => { + let server + + afterEach(async () => { + if (server != null) { + await new Promise((resolve, reject) => { + server.close((err) => { + if (err) { + reject(err) + return + } + + resolve() + }) + }) + } + }) + it('should handle plain text error response', async function () { - const server = http.createServer((req, res) => { + server = http.createServer((req, res) => { // Consume the entire request, before responding. req.on('data', () => {}) req.on('end', () => { @@ -70,12 +111,10 @@ describe('error handling', () => { await expect(httpClient('/ip4/127.0.0.1/tcp/6001').config.replace('test/fixtures/r-config.json')) .to.eventually.be.rejectedWith('ipfs method not allowed') .and.to.have.nested.property('response.status').that.equals(403) - - server.close() }) it('should handle JSON error response', async function () { - const server = http.createServer((req, res) => { + server = http.createServer((req, res) => { // Consume the entire request, before responding. req.on('data', () => {}) req.on('end', () => { @@ -91,12 +130,10 @@ describe('error handling', () => { await expect(httpClient('/ip4/127.0.0.1/tcp/6001').config.replace('test/fixtures/r-config.json')) .to.eventually.be.rejectedWith('client error') .and.to.have.nested.property('response.status').that.equals(400) - - server.close() }) it('should handle JSON error response with invalid JSON', async function () { - const server = http.createServer((req, res) => { + server = http.createServer((req, res) => { // Consume the entire request, before responding. req.on('data', () => {}) req.on('end', () => { @@ -112,7 +149,5 @@ describe('error handling', () => { await expect(httpClient('/ip4/127.0.0.1/tcp/6001').config.replace('test/fixtures/r-config.json')) .to.eventually.be.rejected() .and.to.have.property('message').that.includes('Unexpected token M in JSON at position 2') - - server.close() }) }) diff --git a/packages/ipfs-http-client/test/node/swarm.js b/packages/ipfs-http-client/test/node/swarm.js index 5191ccad5a..d656abb009 100644 --- a/packages/ipfs-http-client/test/node/swarm.js +++ b/packages/ipfs-http-client/test/node/swarm.js @@ -4,7 +4,8 @@ import { expect } from 'aegir/chai' import nock from 'nock' import { create as httpClient } from '../../src/index.js' -describe('.swarm.peers', function () { +// skipped as nock cannot mock undici/fetch requests yet - https://github.com/nock/nock/issues/2183 +describe.skip('.swarm.peers', function () { this.timeout(50 * 1000) // slow CI const ipfs = httpClient('/ip4/127.0.0.1/tcp/5001') diff --git a/packages/ipfs-http-gateway/CHANGELOG.md b/packages/ipfs-http-gateway/CHANGELOG.md index c1775c3dc4..39d7460bcf 100644 --- a/packages/ipfs-http-gateway/CHANGELOG.md +++ b/packages/ipfs-http-gateway/CHANGELOG.md @@ -4,6 +4,50 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.13.0](https://www.github.com/ipfs/js-ipfs/compare/ipfs-http-gateway-v0.12.0...ipfs-http-gateway-v0.13.0) (2023-01-11) + + +### ⚠ BREAKING CHANGES + +* update multiformats to v11.x.x and related depenendcies (#4277) + +### Bug Fixes + +* update multiformats to v11.x.x and related depenendcies ([#4277](https://www.github.com/ipfs/js-ipfs/issues/4277)) ([521c84a](https://www.github.com/ipfs/js-ipfs/commit/521c84a958b04d61702577a5adce28519c1b2a3b)) +* use aegir to publish RCs ([#4284](https://www.github.com/ipfs/js-ipfs/issues/4284)) ([6d90cbf](https://www.github.com/ipfs/js-ipfs/commit/6d90cbf321a7dbf4b1084ba20f0c514dc08d8d0a)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * ipfs-core-types bumped from ^0.13.0 to ^0.14.0 + * ipfs-http-response bumped from ^5.0.0 to ^6.0.0 + +## [0.12.0](https://www.github.com/ipfs/js-ipfs/compare/ipfs-http-gateway-v0.11.1...ipfs-http-gateway-v0.12.0) (2022-10-24) + + +### ⚠ BREAKING CHANGES + +* ipfs is now bundled with libp2p@0.40.x which has different config + +### Features + +* upgrade libp2p to 0.40.x ([#4237](https://www.github.com/ipfs/js-ipfs/issues/4237)) ([0cee4a4](https://www.github.com/ipfs/js-ipfs/commit/0cee4a4c55767022584dcbade0b0b9b43326f9c9)) + + +### Bug Fixes + +* replace slice with subarray for increased performance ([#4210](https://www.github.com/ipfs/js-ipfs/issues/4210)) ([dfc43d4](https://www.github.com/ipfs/js-ipfs/commit/dfc43d4e9be67fdf25553677f469379d966ff806)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * ipfs-core-types bumped from ^0.12.1 to ^0.13.0 + * ipfs-http-response bumped from ^4.0.1 to ^5.0.0 + ### [0.11.1](https://www.github.com/ipfs/js-ipfs/compare/ipfs-http-gateway-v0.11.0...ipfs-http-gateway-v0.11.1) (2022-09-21) diff --git a/packages/ipfs-http-gateway/README.md b/packages/ipfs-http-gateway/README.md index 5d16ba119d..0fc2789d88 100644 --- a/packages/ipfs-http-gateway/README.md +++ b/packages/ipfs-http-gateway/README.md @@ -1,10 +1,9 @@ # ipfs-http-gateway -[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io) -[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) -[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs) +[![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech) +[![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech) [![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs) -[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/js-test-and-release.yml) +[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/js-ipfs/test.yml?branch=master\&style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/test.yml?query=branch%3Amaster) > JavaScript implementation of the IPFS specification diff --git a/packages/ipfs-http-gateway/package.json b/packages/ipfs-http-gateway/package.json index d3b1c0f41a..fc4cad2b7f 100644 --- a/packages/ipfs-http-gateway/package.json +++ b/packages/ipfs-http-gateway/package.json @@ -1,6 +1,6 @@ { "name": "ipfs-http-gateway", - "version": "0.11.1", + "version": "0.13.0", "description": "JavaScript implementation of the IPFS specification", "license": "Apache-2.0 OR MIT", "homepage": "https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-http-gateway#readme", @@ -70,23 +70,23 @@ "@hapi/ammo": "^5.0.1", "@hapi/boom": "^9.1.0", "@hapi/hapi": "^20.0.0", - "@libp2p/logger": "^2.0.0", + "@libp2p/logger": "^2.0.5", "@multiformats/uri-to-multiaddr": "^7.0.0", "hapi-pino": "^8.5.0", - "ipfs-core-types": "^0.12.1", - "ipfs-http-response": "^4.0.1", - "is-ipfs": "^7.0.0", - "it-last": "^1.0.4", + "ipfs-core-types": "^0.14.0", + "ipfs-http-response": "^6.0.0", + "is-ipfs": "^8.0.0", + "it-last": "^2.0.0", "it-to-stream": "^1.0.0", "joi": "^17.2.1", - "multiformats": "^9.5.1", - "uint8arrays": "^3.0.0" + "multiformats": "^11.0.0", + "uint8arrays": "^4.0.2" }, "devDependencies": { "@types/hapi-pino": "^8.0.1", "@types/hapi__hapi": "^20.0.5", - "aegir": "^37.0.11", - "file-type": "^17.1.1", - "sinon": "^14.0.0" + "aegir": "^37.11.0", + "file-type": "^18.0.0", + "sinon": "^15.0.1" } } diff --git a/packages/ipfs-http-gateway/src/resources/gateway.js b/packages/ipfs-http-gateway/src/resources/gateway.js index a34183eeb0..3f3e377a6b 100644 --- a/packages/ipfs-http-gateway/src/resources/gateway.js +++ b/packages/ipfs-http-gateway/src/resources/gateway.js @@ -189,15 +189,15 @@ export const Gateway = { // Add headers to successful responses (regular or range) if (response.statusCode === 200 || response.statusCode === 206) { const path = request.path - response.header('X-Ipfs-Path', path) + response.headers['X-Ipfs-Path'] = path if (path.startsWith('/ipfs/')) { // "set modtime to a really long time ago, since files are immutable and should stay cached" // Source: https://github.com/ipfs/go-ipfs/blob/v0.4.20/core/corehttp/gateway_handler.go#L228-L229 - response.header('Last-Modified', 'Thu, 01 Jan 1970 00:00:01 GMT') + response.headers['Last-Modified'] = 'Thu, 01 Jan 1970 00:00:01 GMT' // Suborigin for /ipfs/: https://github.com/ipfs/in-web-browsers/issues/66 const rootCid = path.split('/')[2] const ipfsOrigin = CID.parse(rootCid).toV1().toString(base32) - response.header('Suborigin', `ipfs000${ipfsOrigin}`) + response.headers.Suborigin = `ipfs000${ipfsOrigin}` } else if (path.startsWith('/ipns/')) { // Suborigin for /ipns/: https://github.com/ipfs/in-web-browsers/issues/66 const root = path.split('/')[2] @@ -205,7 +205,7 @@ export const Gateway = { const ipnsOrigin = isIPFS.cid(root) ? CID.parse(root).toV1().toString(base32) : base32.encode(uint8ArrayFromString(root)) - response.header('Suborigin', `ipns000${ipnsOrigin}`) + response.headers.Suborigin = `ipns000${ipnsOrigin}` } } return h.continue diff --git a/packages/ipfs-http-response/CHANGELOG.md b/packages/ipfs-http-response/CHANGELOG.md index 5cc103b599..fef88168a6 100644 --- a/packages/ipfs-http-response/CHANGELOG.md +++ b/packages/ipfs-http-response/CHANGELOG.md @@ -3,6 +3,48 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [6.0.0](https://www.github.com/ipfs/js-ipfs/compare/ipfs-http-response-v5.0.0...ipfs-http-response-v6.0.0) (2023-01-11) + + +### ⚠ BREAKING CHANGES + +* update multiformats to v11.x.x and related depenendcies (#4277) + +### Bug Fixes + +* update multiformats to v11.x.x and related depenendcies ([#4277](https://www.github.com/ipfs/js-ipfs/issues/4277)) ([521c84a](https://www.github.com/ipfs/js-ipfs/commit/521c84a958b04d61702577a5adce28519c1b2a3b)) +* use aegir to publish RCs ([#4284](https://www.github.com/ipfs/js-ipfs/issues/4284)) ([6d90cbf](https://www.github.com/ipfs/js-ipfs/commit/6d90cbf321a7dbf4b1084ba20f0c514dc08d8d0a)) + + +### Dependencies + +* The following workspace dependencies were updated + * devDependencies + * ipfs-core bumped from ^0.17.0 to ^0.18.0 + +## [5.0.0](https://www.github.com/ipfs/js-ipfs/compare/ipfs-http-response-v4.0.1...ipfs-http-response-v5.0.0) (2022-10-24) + + +### ⚠ BREAKING CHANGES + +* ipfs is now bundled with libp2p@0.40.x which has different config + +### Features + +* upgrade libp2p to 0.40.x ([#4237](https://www.github.com/ipfs/js-ipfs/issues/4237)) ([0cee4a4](https://www.github.com/ipfs/js-ipfs/commit/0cee4a4c55767022584dcbade0b0b9b43326f9c9)) + + +### Bug Fixes + +* replace slice with subarray for increased performance ([#4210](https://www.github.com/ipfs/js-ipfs/issues/4210)) ([dfc43d4](https://www.github.com/ipfs/js-ipfs/commit/dfc43d4e9be67fdf25553677f469379d966ff806)) + + +### Dependencies + +* The following workspace dependencies were updated + * devDependencies + * ipfs-core bumped from ^0.16.1 to ^0.17.0 + ### [4.0.1](https://www.github.com/ipfs/js-ipfs/compare/ipfs-http-response-v4.0.0...ipfs-http-response-v4.0.1) (2022-09-21) diff --git a/packages/ipfs-http-response/README.md b/packages/ipfs-http-response/README.md index 640baa0551..37bb786279 100644 --- a/packages/ipfs-http-response/README.md +++ b/packages/ipfs-http-response/README.md @@ -1,10 +1,9 @@ # ipfs-http-response -[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io) -[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) -[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs) +[![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech) +[![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech) [![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs) -[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/js-test-and-release.yml) +[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/js-ipfs/test.yml?branch=master\&style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/test.yml?query=branch%3Amaster) > Creates an HTTP response from an IPFS Hash diff --git a/packages/ipfs-http-response/package.json b/packages/ipfs-http-response/package.json index 7fa2ca6d0e..d9a2e076dc 100644 --- a/packages/ipfs-http-response/package.json +++ b/packages/ipfs-http-response/package.json @@ -1,6 +1,6 @@ { "name": "ipfs-http-response", - "version": "4.0.1", + "version": "6.0.0", "description": "Creates an HTTP response from an IPFS Hash", "author": "Vasco Santos ", "license": "Apache-2.0 OR MIT", @@ -66,13 +66,11 @@ "dep-check": "aegir dep-check -i global" }, "dependencies": { - "@libp2p/logger": "^2.0.0", + "@libp2p/logger": "^2.0.5", "ejs": "^3.1.6", - "file-type": "^17.1.1", - "filesize": "^9.0.11", - "it-buffer": "^0.1.1", - "it-concat": "^2.0.0", - "it-map": "^1.0.6", + "file-type": "^18.0.0", + "filesize": "^10.0.5", + "it-map": "^2.0.0", "it-reader": "^6.0.1", "it-to-stream": "^1.0.0", "mime-types": "^2.1.30", @@ -81,12 +79,12 @@ "devDependencies": { "@types/ejs": "^3.1.0", "@types/mime-types": "^2.1.1", - "aegir": "^37.0.11", + "aegir": "^37.11.0", "get-stream": "^6.0.0", - "ipfs-core": "^0.16.1", - "ipfsd-ctl": "^12.0.3", - "it-all": "^1.0.4", - "uint8arrays": "^3.0.0" + "ipfs-core": "^0.18.0", + "ipfsd-ctl": "^13.0.0", + "it-all": "^2.0.0", + "uint8arrays": "^4.0.2" }, "browser": { "file-type": "file-type/browser", diff --git a/packages/ipfs-http-response/src/dir-view/index.js b/packages/ipfs-http-response/src/dir-view/index.js index 61afe89410..8bd4e3a3a0 100644 --- a/packages/ipfs-http-response/src/dir-view/index.js +++ b/packages/ipfs-http-response/src/dir-view/index.js @@ -1,4 +1,4 @@ -import filesize from 'filesize' +import { filesize } from 'filesize' import style from './style.js' import { cidArray } from '../utils/path.js' import ejs from 'ejs' diff --git a/packages/ipfs-http-response/src/index.js b/packages/ipfs-http-response/src/index.js index 821dbaa202..64e3df0194 100644 --- a/packages/ipfs-http-response/src/index.js +++ b/packages/ipfs-http-response/src/index.js @@ -1,10 +1,7 @@ -/* global Response, Blob */ +/* global Response */ // @ts-expect-error no types import toStream from 'it-to-stream' -import concat from 'it-concat' -// @ts-expect-error no types -import toBuffer from 'it-buffer' import { logger } from '@libp2p/logger' import * as ipfsResolver from './resolver.js' import * as pathUtils from './utils/path.js' @@ -71,25 +68,11 @@ export async function getResponse (ipfsNode, ipfsPath) { try { const resolvedData = await ipfsResolver.cid(ipfsNode, ipfsPath) const { source, contentType } = await detectContentType(ipfsPath, ipfsNode.cat(resolvedData.cid)) + const responseStream = toStream.readable(source) - if (typeof Blob === 'undefined') { - const responseStream = toStream.readable(toBuffer(source)) - - return contentType - ? new Response(responseStream, getHeader(200, 'OK', { 'Content-Type': contentType })) - : new Response(responseStream, getHeader()) - } - - try { - const data = await concat(source) - const blob = new Blob([data.slice()]) - - return contentType - ? new Response(blob, getHeader(200, 'OK', { 'Content-Type': contentType })) - : new Response(blob, getHeader()) - } catch (/** @type {any} */ err) { - return new Response(err.toString(), getHeader(500, 'Error fetching the file')) - } + return contentType + ? new Response(responseStream, getHeader(200, 'OK', { 'Content-Type': contentType })) + : new Response(responseStream, getHeader()) } catch (/** @type {any} */ error) { log(error) return handleResolveError(ipfsNode, ipfsPath, error) diff --git a/packages/ipfs-http-response/src/utils/content-type.js b/packages/ipfs-http-response/src/utils/content-type.js index eff8d80a83..7f0c912d82 100644 --- a/packages/ipfs-http-response/src/utils/content-type.js +++ b/packages/ipfs-http-response/src/utils/content-type.js @@ -39,7 +39,9 @@ export const detectContentType = async (path, source) => { yield * stream })() } catch (/** @type {any} */ err) { - if (err.code !== 'ERR_UNDER_READ') throw err + if (err.code !== 'ERR_UNDER_READ') { + throw err + } // not enough bytes for sniffing, just yield the data output = (async function * () { // eslint-disable-line require-await diff --git a/packages/ipfs-http-server/CHANGELOG.md b/packages/ipfs-http-server/CHANGELOG.md index 9f8ffbe707..db2e62bb6a 100644 --- a/packages/ipfs-http-server/CHANGELOG.md +++ b/packages/ipfs-http-server/CHANGELOG.md @@ -3,6 +3,51 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.15.0](https://www.github.com/ipfs/js-ipfs/compare/ipfs-http-server-v0.14.0...ipfs-http-server-v0.15.0) (2023-01-11) + + +### ⚠ BREAKING CHANGES + +* update multiformats to v11.x.x and related depenendcies (#4277) + +### Bug Fixes + +* update multiformats to v11.x.x and related depenendcies ([#4277](https://www.github.com/ipfs/js-ipfs/issues/4277)) ([521c84a](https://www.github.com/ipfs/js-ipfs/commit/521c84a958b04d61702577a5adce28519c1b2a3b)) +* use aegir to publish RCs ([#4284](https://www.github.com/ipfs/js-ipfs/issues/4284)) ([6d90cbf](https://www.github.com/ipfs/js-ipfs/commit/6d90cbf321a7dbf4b1084ba20f0c514dc08d8d0a)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * ipfs-core-types bumped from ^0.13.0 to ^0.14.0 + * ipfs-core-utils bumped from ^0.17.0 to ^0.18.0 + * ipfs-http-gateway bumped from ^0.12.0 to ^0.13.0 + * devDependencies + * ipfs-http-client bumped from ^59.0.0 to ^60.0.0 + +## [0.14.0](https://www.github.com/ipfs/js-ipfs/compare/ipfs-http-server-v0.13.2...ipfs-http-server-v0.14.0) (2022-10-24) + + +### ⚠ BREAKING CHANGES + +* ipfs is now bundled with libp2p@0.40.x which has different config + +### Features + +* upgrade libp2p to 0.40.x ([#4237](https://www.github.com/ipfs/js-ipfs/issues/4237)) ([0cee4a4](https://www.github.com/ipfs/js-ipfs/commit/0cee4a4c55767022584dcbade0b0b9b43326f9c9)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * ipfs-core-types bumped from ^0.12.1 to ^0.13.0 + * ipfs-core-utils bumped from ^0.16.1 to ^0.17.0 + * ipfs-http-gateway bumped from ^0.11.1 to ^0.12.0 + * devDependencies + * ipfs-http-client bumped from ^58.0.1 to ^59.0.0 + ### [0.13.2](https://www.github.com/ipfs/js-ipfs/compare/ipfs-http-server-v0.13.1...ipfs-http-server-v0.13.2) (2022-09-21) diff --git a/packages/ipfs-http-server/README.md b/packages/ipfs-http-server/README.md index 51f5921326..5648531849 100644 --- a/packages/ipfs-http-server/README.md +++ b/packages/ipfs-http-server/README.md @@ -1,10 +1,9 @@ # ipfs-http-server -[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io) -[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) -[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs) +[![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech) +[![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech) [![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs) -[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/js-test-and-release.yml) +[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/js-ipfs/test.yml?branch=master\&style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/test.yml?query=branch%3Amaster) > JavaScript implementation of the IPFS specification diff --git a/packages/ipfs-http-server/package.json b/packages/ipfs-http-server/package.json index 4dd51c632b..7cccf8a679 100644 --- a/packages/ipfs-http-server/package.json +++ b/packages/ipfs-http-server/package.json @@ -1,6 +1,6 @@ { "name": "ipfs-http-server", - "version": "0.13.2", + "version": "0.15.0", "description": "JavaScript implementation of the IPFS specification", "license": "Apache-2.0 OR MIT", "homepage": "https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-http-server#readme", @@ -67,51 +67,51 @@ "@hapi/boom": "^9.1.0", "@hapi/content": "^5.0.2", "@hapi/hapi": "^20.0.0", - "@ipld/dag-pb": "^2.1.3", - "@libp2p/interface-dht": "^1.0.1", - "@libp2p/interfaces": "^3.0.3", - "@libp2p/logger": "^2.0.0", - "@libp2p/peer-id": "^1.1.10", - "@multiformats/multiaddr": "^11.0.0", + "@ipld/dag-pb": "^4.0.0", + "@libp2p/interface-dht": "^2.0.0", + "@libp2p/interfaces": "^3.2.0", + "@libp2p/logger": "^2.0.5", + "@libp2p/peer-id": "^2.0.0", + "@multiformats/multiaddr": "^11.1.5", "@multiformats/uri-to-multiaddr": "^7.0.0", "any-signal": "^3.0.0", "dlv": "^1.1.3", "hapi-pino": "^8.5.0", - "ipfs-core-types": "^0.12.1", - "ipfs-core-utils": "^0.16.1", - "ipfs-http-gateway": "^0.11.1", - "ipfs-unixfs": "^7.0.0", - "it-all": "^1.0.4", - "it-drain": "^1.0.3", - "it-filter": "^1.0.2", - "it-last": "^1.0.4", - "it-map": "^1.0.6", - "it-merge": "^1.0.3", - "it-multipart": "^2.0.0", + "ipfs-core-types": "^0.14.0", + "ipfs-core-utils": "^0.18.0", + "ipfs-http-gateway": "^0.13.0", + "ipfs-unixfs": "^9.0.0", + "it-all": "^2.0.0", + "it-drain": "^2.0.0", + "it-filter": "^2.0.0", + "it-last": "^2.0.0", + "it-map": "^2.0.0", + "it-merge": "^2.0.0", + "it-multipart": "^3.0.0", "it-pipe": "^2.0.3", "it-pushable": "^3.0.0", - "it-reduce": "^1.0.5", + "it-reduce": "^2.0.0", "joi": "^17.2.1", "just-safe-set": "^4.0.2", - "multiformats": "^9.5.1", + "multiformats": "^11.0.0", "parse-duration": "^1.0.0", "stream-to-it": "^0.2.2", "timeout-abort-controller": "^3.0.0", - "uint8arrays": "^3.0.0" + "uint8arrays": "^4.0.2" }, "devDependencies": { "@types/hapi-pino": "^8.0.1", "@types/hapi__hapi": "^20.0.5", "@types/node": "^18.0.0", - "aegir": "^37.0.11", + "aegir": "^37.11.0", "err-code": "^3.0.1", "form-data": "^4.0.0", - "ipfs-http-client": "^58.0.1", + "ipfs-http-client": "^60.0.0", "iso-random-stream": "^2.0.2", - "it-first": "^1.0.4", - "it-to-buffer": "^2.0.0", + "it-first": "^2.0.0", + "it-to-buffer": "^3.0.0", "qs": "^6.9.4", - "sinon": "^14.0.0", + "sinon": "^15.0.1", "stream-to-promise": "^3.0.0" }, "optionalDependencies": { diff --git a/packages/ipfs-http-server/src/api/resources/swarm.js b/packages/ipfs-http-server/src/api/resources/swarm.js index a798e79c65..c7a41243fd 100644 --- a/packages/ipfs-http-server/src/api/resources/swarm.js +++ b/packages/ipfs-http-server/src/api/resources/swarm.js @@ -1,4 +1,6 @@ import Joi from '../../utils/joi.js' +import { peerIdFromString } from '@libp2p/peer-id' +import { multiaddr } from '@multiformats/multiaddr' export const peersResource = { options: { @@ -196,7 +198,15 @@ export const connectResource = { } }) - await ipfs.swarm.connect(addr, { + let peerIdOrMultiaddr + + if (addr[0] === '/') { + peerIdOrMultiaddr = multiaddr(addr) + } else { + peerIdOrMultiaddr = peerIdFromString(addr) + } + + await ipfs.swarm.connect(peerIdOrMultiaddr, { signal: controller.signal, timeout }) @@ -246,7 +256,15 @@ export const disconnectResource = { } } = request - await ipfs.swarm.disconnect(addr, { + let peerIdOrMultiaddr + + if (addr[0] === '/') { + peerIdOrMultiaddr = multiaddr(addr) + } else { + peerIdOrMultiaddr = peerIdFromString(addr) + } + + await ipfs.swarm.disconnect(peerIdOrMultiaddr, { signal, timeout }) diff --git a/packages/ipfs-http-server/src/api/routes/debug.js b/packages/ipfs-http-server/src/api/routes/debug.js index 9c71514cd7..ad7bc6ee08 100644 --- a/packages/ipfs-http-server/src/api/routes/debug.js +++ b/packages/ipfs-http-server/src/api/routes/debug.js @@ -4,18 +4,6 @@ import client from 'prom-client' import Boom from '@hapi/boom' import { disable, enable } from '@libp2p/logger' -// Clear the register to make sure we're not registering multiple ones -client.register.clear() - -/** @type {Record>} */ -const gauges = { - nodejs_memory_usage: new client.Gauge({ - name: 'nodejs_memory_usage', - help: 'nodejs_memory_usage', - labelNames: Object.keys(process.memoryUsage()) - }) -} - // Endpoint for handling debug metrics export default [{ method: 'GET', @@ -29,52 +17,6 @@ export default [{ throw Boom.notImplemented('Monitoring is disabled. Enable it by setting environment variable IPFS_MONITORING') } - Object.entries(process.memoryUsage()).forEach(([key, value]) => { - gauges.nodejs_memory_usage.set({ [key]: key }, value) - }) - - const { ipfs } = request.server.app - // @ts-expect-error libp2p does not exist on ipfs - const metrics = ipfs.libp2p.metrics - - if (metrics) { - for (const [system, components] of metrics.getComponentMetrics().entries()) { - for (const [component, componentMetrics] of components.entries()) { - for (const [metricName, trackedMetric] of componentMetrics.entries()) { - const name = `${system}-${component}-${metricName}`.replace(/-/g, '_') - const labelName = trackedMetric.label ?? metricName.replace(/-/g, '_') - const help = trackedMetric.help ?? metricName.replace(/-/g, '_') - - /** @type {client.GaugeConfiguration} */ - const gaugeOptions = { name, help } - const metricValue = await trackedMetric.calculate() - - if (typeof metricValue !== 'number') { - // metric group - gaugeOptions.labelNames = [ - labelName - ] - } - - if (!gauges[name]) { - // create metric if it's not been seen before - gauges[name] = new client.Gauge(gaugeOptions) - } - - if (typeof metricValue !== 'number') { - // metric group - Object.entries(metricValue).forEach(([key, value]) => { - gauges[name].set({ [labelName]: key }, value) - }) - } else { - // metric value - gauges[name].set(metricValue) - } - } - } - } - } - return h.response(await client.register.metrics()) .type(client.register.contentType) } diff --git a/packages/ipfs-http-server/test/inject/swarm.js b/packages/ipfs-http-server/test/inject/swarm.js index 1683348001..2e2240726e 100644 --- a/packages/ipfs-http-server/test/inject/swarm.js +++ b/packages/ipfs-http-server/test/inject/swarm.js @@ -278,7 +278,7 @@ describe('/swarm', () => { expect(res).to.have.property('statusCode', 200) expect(res).to.have.nested.property('result.Strings').with.lengthOf(1).that.includes(`connect ${multiaddr} success`) - expect(ipfs.swarm.connect.calledWith(multiaddr, defaultOptions)).to.be.true() + expect(ipfs.swarm.connect.calledWith(sinon.match(ma => ma.toString() === multiaddr), defaultOptions)).to.be.true() }) it('should accept timeout', async () => { @@ -289,7 +289,7 @@ describe('/swarm', () => { expect(res).to.have.property('statusCode', 200) expect(res).to.have.nested.property('result.Strings').with.lengthOf(1).that.includes(`connect ${multiaddr} success`) - expect(ipfs.swarm.connect.calledWith(multiaddr, { + expect(ipfs.swarm.connect.calledWith(sinon.match(ma => ma.toString() === multiaddr), { ...defaultOptions, timeout: 1000 })).to.be.true() @@ -314,7 +314,7 @@ describe('/swarm', () => { expect(res).to.have.property('statusCode', 200) expect(res).to.have.nested.property('result.Strings').with.lengthOf(1).that.includes(`disconnect ${multiaddr} success`) - expect(ipfs.swarm.disconnect.calledWith(multiaddr, defaultOptions)).to.be.true() + expect(ipfs.swarm.disconnect.calledWith(sinon.match(ma => ma.toString() === multiaddr), defaultOptions)).to.be.true() }) it('should accept timeout', async () => { @@ -325,7 +325,7 @@ describe('/swarm', () => { expect(res).to.have.property('statusCode', 200) expect(res).to.have.nested.property('result.Strings').with.lengthOf(1).that.includes(`disconnect ${multiaddr} success`) - expect(ipfs.swarm.disconnect.calledWith(multiaddr, { + expect(ipfs.swarm.disconnect.calledWith(sinon.match(ma => ma.toString() === multiaddr), { ...defaultOptions, timeout: 1000 })).to.be.true() diff --git a/packages/ipfs-message-port-client/.aegir.js b/packages/ipfs-message-port-client/.aegir.js index 5f0ca24907..1d3d9961be 100644 --- a/packages/ipfs-message-port-client/.aegir.js +++ b/packages/ipfs-message-port-client/.aegir.js @@ -7,17 +7,7 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url)) /** @type {import('aegir').Options["build"]["config"]} */ const buildConfig = { - inject: [path.join(__dirname, '../../scripts/node-globals.js')], - plugins: [ - { - name: 'node built ins', - setup (build) { - build.onResolve({ filter: /^stream$/ }, () => { - return { path: require.resolve('readable-stream') } - }) - } - } - ] + inject: [path.join(__dirname, '../../scripts/node-globals.js')] } /** @type {import('aegir').PartialOptions} */ diff --git a/packages/ipfs-message-port-client/CHANGELOG.md b/packages/ipfs-message-port-client/CHANGELOG.md index 34baf859c1..c089cb6ea3 100644 --- a/packages/ipfs-message-port-client/CHANGELOG.md +++ b/packages/ipfs-message-port-client/CHANGELOG.md @@ -3,6 +3,53 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.15.0](https://www.github.com/ipfs/js-ipfs/compare/ipfs-message-port-client-v0.14.0...ipfs-message-port-client-v0.15.0) (2023-01-11) + + +### ⚠ BREAKING CHANGES + +* update multiformats to v11.x.x and related depenendcies (#4277) + +### Bug Fixes + +* update multiformats to v11.x.x and related depenendcies ([#4277](https://www.github.com/ipfs/js-ipfs/issues/4277)) ([521c84a](https://www.github.com/ipfs/js-ipfs/commit/521c84a958b04d61702577a5adce28519c1b2a3b)) +* use aegir to publish RCs ([#4284](https://www.github.com/ipfs/js-ipfs/issues/4284)) ([6d90cbf](https://www.github.com/ipfs/js-ipfs/commit/6d90cbf321a7dbf4b1084ba20f0c514dc08d8d0a)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * ipfs-core-types bumped from ^0.13.0 to ^0.14.0 + * ipfs-message-port-protocol bumped from ^0.14.0 to ^0.15.0 + * devDependencies + * interface-ipfs-core bumped from ^0.157.0 to ^0.158.0 + * ipfs-core bumped from ^0.17.0 to ^0.18.0 + * ipfs-message-port-server bumped from ^0.14.0 to ^0.15.0 + +## [0.14.0](https://www.github.com/ipfs/js-ipfs/compare/ipfs-message-port-client-v0.13.1...ipfs-message-port-client-v0.14.0) (2022-10-24) + + +### ⚠ BREAKING CHANGES + +* ipfs is now bundled with libp2p@0.40.x which has different config + +### Features + +* upgrade libp2p to 0.40.x ([#4237](https://www.github.com/ipfs/js-ipfs/issues/4237)) ([0cee4a4](https://www.github.com/ipfs/js-ipfs/commit/0cee4a4c55767022584dcbade0b0b9b43326f9c9)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * ipfs-core-types bumped from ^0.12.1 to ^0.13.0 + * ipfs-message-port-protocol bumped from ^0.13.1 to ^0.14.0 + * devDependencies + * interface-ipfs-core bumped from ^0.156.1 to ^0.157.0 + * ipfs-core bumped from ^0.16.1 to ^0.17.0 + * ipfs-message-port-server bumped from ^0.13.1 to ^0.14.0 + ### [0.13.1](https://www.github.com/ipfs/js-ipfs/compare/ipfs-message-port-client-v0.13.0...ipfs-message-port-client-v0.13.1) (2022-09-21) @@ -577,4 +624,4 @@ Co-authored-by: achingbrain ### Features -* share IPFS node between browser tabs ([#3081](https://github.com/ipfs/js-ipfs/issues/3081)) ([1b8b1b8](https://github.com/ipfs/js-ipfs/commit/1b8b1b822a252498889c54972a1f57e1fedc39d0)), closes [#3022](https://github.com/ipfs/js-ipfs/issues/3022) +* share IPFS node between browser tabs ([#3081](https://github.com/ipfs/js-ipfs/issues/3081)) ([1b8b1b8](https://github.com/ipfs/js-ipfs/commit/1b8b1b822a252498889c54972a1f57e1fedc39d0)), closes [#3022](https://github.com/ipfs/js-ipfs/issues/3022) \ No newline at end of file diff --git a/packages/ipfs-message-port-client/README.md b/packages/ipfs-message-port-client/README.md index dc26cc5566..5f1b8283b4 100644 --- a/packages/ipfs-message-port-client/README.md +++ b/packages/ipfs-message-port-client/README.md @@ -1,10 +1,9 @@ # ipfs-message-port-client -[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io) -[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) -[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs) +[![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech) +[![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech) [![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs) -[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/js-test-and-release.yml) +[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/js-ipfs/test.yml?branch=master\&style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/test.yml?query=branch%3Amaster) > IPFS client library for accessing IPFS node over message port diff --git a/packages/ipfs-message-port-client/package.json b/packages/ipfs-message-port-client/package.json index 95a7a04465..a2cfafeaa9 100644 --- a/packages/ipfs-message-port-client/package.json +++ b/packages/ipfs-message-port-client/package.json @@ -1,6 +1,6 @@ { "name": "ipfs-message-port-client", - "version": "0.13.1", + "version": "0.15.0", "description": "IPFS client library for accessing IPFS node over message port", "license": "Apache-2.0 OR MIT", "homepage": "https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme", @@ -64,18 +64,18 @@ "dep-check": "aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild" }, "dependencies": { - "browser-readablestream-to-it": "^1.0.1", + "browser-readablestream-to-it": "^2.0.0", "err-code": "^3.0.1", - "ipfs-core-types": "^0.12.1", - "ipfs-message-port-protocol": "^0.13.1", - "ipfs-unixfs": "^7.0.0", - "it-peekable": "^1.0.2", - "multiformats": "^9.5.1" + "ipfs-core-types": "^0.14.0", + "ipfs-message-port-protocol": "^0.15.0", + "ipfs-unixfs": "^9.0.0", + "it-peekable": "^2.0.0", + "multiformats": "^11.0.0" }, "devDependencies": { - "aegir": "^37.0.11", - "interface-ipfs-core": "^0.156.1", - "ipfs-core": "^0.16.1", - "ipfs-message-port-server": "^0.13.1" + "aegir": "^37.11.0", + "interface-ipfs-core": "^0.158.0", + "ipfs-core": "^0.18.0", + "ipfs-message-port-server": "^0.15.0" } } diff --git a/packages/ipfs-message-port-protocol/CHANGELOG.md b/packages/ipfs-message-port-protocol/CHANGELOG.md index 8582118e94..936312c17a 100644 --- a/packages/ipfs-message-port-protocol/CHANGELOG.md +++ b/packages/ipfs-message-port-protocol/CHANGELOG.md @@ -3,6 +3,43 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.15.0](https://www.github.com/ipfs/js-ipfs/compare/ipfs-message-port-protocol-v0.14.0...ipfs-message-port-protocol-v0.15.0) (2023-01-11) + + +### ⚠ BREAKING CHANGES + +* update multiformats to v11.x.x and related depenendcies (#4277) + +### Bug Fixes + +* update multiformats to v11.x.x and related depenendcies ([#4277](https://www.github.com/ipfs/js-ipfs/issues/4277)) ([521c84a](https://www.github.com/ipfs/js-ipfs/commit/521c84a958b04d61702577a5adce28519c1b2a3b)) +* use aegir to publish RCs ([#4284](https://www.github.com/ipfs/js-ipfs/issues/4284)) ([6d90cbf](https://www.github.com/ipfs/js-ipfs/commit/6d90cbf321a7dbf4b1084ba20f0c514dc08d8d0a)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * ipfs-core-types bumped from ^0.13.0 to ^0.14.0 + +## [0.14.0](https://www.github.com/ipfs/js-ipfs/compare/ipfs-message-port-protocol-v0.13.1...ipfs-message-port-protocol-v0.14.0) (2022-10-24) + + +### ⚠ BREAKING CHANGES + +* ipfs is now bundled with libp2p@0.40.x which has different config + +### Features + +* upgrade libp2p to 0.40.x ([#4237](https://www.github.com/ipfs/js-ipfs/issues/4237)) ([0cee4a4](https://www.github.com/ipfs/js-ipfs/commit/0cee4a4c55767022584dcbade0b0b9b43326f9c9)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * ipfs-core-types bumped from ^0.12.1 to ^0.13.0 + ### [0.13.1](https://www.github.com/ipfs/js-ipfs/compare/ipfs-message-port-protocol-v0.13.0...ipfs-message-port-protocol-v0.13.1) (2022-09-21) @@ -404,4 +441,4 @@ Co-authored-by: achingbrain ### Features -* share IPFS node between browser tabs ([#3081](https://github.com/ipfs/js-ipfs/issues/3081)) ([1b8b1b8](https://github.com/ipfs/js-ipfs/commit/1b8b1b822a252498889c54972a1f57e1fedc39d0)), closes [#3022](https://github.com/ipfs/js-ipfs/issues/3022) +* share IPFS node between browser tabs ([#3081](https://github.com/ipfs/js-ipfs/issues/3081)) ([1b8b1b8](https://github.com/ipfs/js-ipfs/commit/1b8b1b822a252498889c54972a1f57e1fedc39d0)), closes [#3022](https://github.com/ipfs/js-ipfs/issues/3022) \ No newline at end of file diff --git a/packages/ipfs-message-port-protocol/README.md b/packages/ipfs-message-port-protocol/README.md index 1163666874..6d1092e9f2 100644 --- a/packages/ipfs-message-port-protocol/README.md +++ b/packages/ipfs-message-port-protocol/README.md @@ -1,16 +1,16 @@ # ipfs-message-port-protocol -[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io) -[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) -[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs) +[![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech) +[![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech) [![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs) -[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/js-test-and-release.yml) +[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/js-ipfs/test.yml?branch=master\&style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/test.yml?query=branch%3Amaster) > IPFS client/server protocol over message port ## Table of contents - [Install](#install) + - [Browser ` +``` + ## Usage ## Wire protocol codecs diff --git a/packages/ipfs-message-port-protocol/package.json b/packages/ipfs-message-port-protocol/package.json index 1a2b7c9535..da28d7c388 100644 --- a/packages/ipfs-message-port-protocol/package.json +++ b/packages/ipfs-message-port-protocol/package.json @@ -1,6 +1,6 @@ { "name": "ipfs-message-port-protocol", - "version": "0.13.1", + "version": "0.15.0", "description": "IPFS client/server protocol over message port", "license": "Apache-2.0 OR MIT", "homepage": "https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-protocol#readme", @@ -87,11 +87,11 @@ "dep-check": "aegir dep-check -i ipfs-core-types" }, "dependencies": { - "ipfs-core-types": "^0.12.1", - "multiformats": "^9.5.1" + "ipfs-core-types": "^0.14.0", + "multiformats": "^11.0.0" }, "devDependencies": { - "aegir": "^37.0.11", - "uint8arrays": "^3.0.0" + "aegir": "^37.11.0", + "uint8arrays": "^4.0.2" } } diff --git a/packages/ipfs-message-port-protocol/src/cid.js b/packages/ipfs-message-port-protocol/src/cid.js index 584dfcd238..dadfd06f2f 100644 --- a/packages/ipfs-message-port-protocol/src/cid.js +++ b/packages/ipfs-message-port-protocol/src/cid.js @@ -36,28 +36,22 @@ export const decodeCID = encodedCID => { // @ts-expect-error we are converting this into an object compatible with the CID class const cid = (encodedCID) - // @ts-expect-error non-enumerable field that doesn't always get transferred - if (!cid._baseCache) { - Object.defineProperty(cid, '_baseCache', { - value: new Map() - }) - } - - // @ts-expect-error non-enumerable field that doesn't always get transferred if (!cid.asCID) { Object.defineProperty(cid, 'asCID', { get: () => cid }) } + if (!cid['/']) { + Object.defineProperty(cid, '/', { + get: () => cid.bytes + }) + } + Object.setPrototypeOf(cid.multihash.digest, Uint8Array.prototype) Object.setPrototypeOf(cid.multihash.bytes, Uint8Array.prototype) Object.setPrototypeOf(cid.bytes, Uint8Array.prototype) Object.setPrototypeOf(cid, CID.prototype) - // TODO: Figure out a way to avoid `Symbol.for` here as it can get out of - // sync with cids implementation. - // See: https://github.com/moxystudio/js-class-is/issues/25 - Object.defineProperty(cid, Symbol.for('@ipld/js-cid/CID'), { value: true }) return cid } diff --git a/packages/ipfs-message-port-protocol/src/dag.js b/packages/ipfs-message-port-protocol/src/dag.js index ae630c46eb..1682e58be7 100644 --- a/packages/ipfs-message-port-protocol/src/dag.js +++ b/packages/ipfs-message-port-protocol/src/dag.js @@ -66,7 +66,8 @@ const collectNode = (value, cids, transfer) => { const cid = CID.asCID(value) if (cid) { - cids.push(cid) + // @ts-expect-error - this has to be the same instance + cids.push(value) encodeCID(cid, transfer) } else if (value instanceof ArrayBuffer) { if (transfer) { diff --git a/packages/ipfs-message-port-server/CHANGELOG.md b/packages/ipfs-message-port-server/CHANGELOG.md index a98b5b6eb4..1bf6a2cd17 100644 --- a/packages/ipfs-message-port-server/CHANGELOG.md +++ b/packages/ipfs-message-port-server/CHANGELOG.md @@ -3,6 +3,45 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.15.0](https://www.github.com/ipfs/js-ipfs/compare/ipfs-message-port-server-v0.14.0...ipfs-message-port-server-v0.15.0) (2023-01-11) + + +### ⚠ BREAKING CHANGES + +* update multiformats to v11.x.x and related depenendcies (#4277) + +### Bug Fixes + +* update multiformats to v11.x.x and related depenendcies ([#4277](https://www.github.com/ipfs/js-ipfs/issues/4277)) ([521c84a](https://www.github.com/ipfs/js-ipfs/commit/521c84a958b04d61702577a5adce28519c1b2a3b)) +* use aegir to publish RCs ([#4284](https://www.github.com/ipfs/js-ipfs/issues/4284)) ([6d90cbf](https://www.github.com/ipfs/js-ipfs/commit/6d90cbf321a7dbf4b1084ba20f0c514dc08d8d0a)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * ipfs-core-types bumped from ^0.13.0 to ^0.14.0 + * ipfs-message-port-protocol bumped from ^0.14.0 to ^0.15.0 + +## [0.14.0](https://www.github.com/ipfs/js-ipfs/compare/ipfs-message-port-server-v0.13.1...ipfs-message-port-server-v0.14.0) (2022-10-24) + + +### ⚠ BREAKING CHANGES + +* ipfs is now bundled with libp2p@0.40.x which has different config + +### Features + +* upgrade libp2p to 0.40.x ([#4237](https://www.github.com/ipfs/js-ipfs/issues/4237)) ([0cee4a4](https://www.github.com/ipfs/js-ipfs/commit/0cee4a4c55767022584dcbade0b0b9b43326f9c9)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * ipfs-core-types bumped from ^0.12.1 to ^0.13.0 + * ipfs-message-port-protocol bumped from ^0.13.1 to ^0.14.0 + ### [0.13.1](https://www.github.com/ipfs/js-ipfs/compare/ipfs-message-port-server-v0.13.0...ipfs-message-port-server-v0.13.1) (2022-09-21) @@ -452,4 +491,4 @@ Co-authored-by: achingbrain ### Features -* share IPFS node between browser tabs ([#3081](https://github.com/ipfs/js-ipfs/issues/3081)) ([1b8b1b8](https://github.com/ipfs/js-ipfs/commit/1b8b1b822a252498889c54972a1f57e1fedc39d0)), closes [#3022](https://github.com/ipfs/js-ipfs/issues/3022) +* share IPFS node between browser tabs ([#3081](https://github.com/ipfs/js-ipfs/issues/3081)) ([1b8b1b8](https://github.com/ipfs/js-ipfs/commit/1b8b1b822a252498889c54972a1f57e1fedc39d0)), closes [#3022](https://github.com/ipfs/js-ipfs/issues/3022) \ No newline at end of file diff --git a/packages/ipfs-message-port-server/README.md b/packages/ipfs-message-port-server/README.md index 421259f484..d0cfe08e33 100644 --- a/packages/ipfs-message-port-server/README.md +++ b/packages/ipfs-message-port-server/README.md @@ -1,16 +1,16 @@ # ipfs-message-port-server -[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io) -[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) -[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs) +[![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech) +[![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech) [![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs) -[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/js-test-and-release.yml) +[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/js-ipfs/test.yml?branch=master\&style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/test.yml?query=branch%3Amaster) > IPFS server library for exposing IPFS node over message port ## Table of contents - [Install](#install) + - [Browser ` +``` + ## Usage This library can wrap a JS IPFS node and expose it over the [message channel][]. diff --git a/packages/ipfs-message-port-server/package.json b/packages/ipfs-message-port-server/package.json index 3ba12133cd..22c38dea22 100644 --- a/packages/ipfs-message-port-server/package.json +++ b/packages/ipfs-message-port-server/package.json @@ -1,6 +1,6 @@ { "name": "ipfs-message-port-server", - "version": "0.13.1", + "version": "0.15.0", "description": "IPFS server library for exposing IPFS node over message port", "license": "Apache-2.0 OR MIT", "homepage": "https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-server#readme", @@ -92,13 +92,13 @@ "dep-check": "aegir dep-check -i ipfs-core-types" }, "dependencies": { - "ipfs-core-types": "^0.12.1", - "ipfs-message-port-protocol": "^0.13.1", - "it-all": "^1.0.4" + "ipfs-core-types": "^0.14.0", + "ipfs-message-port-protocol": "^0.15.0", + "it-all": "^2.0.0" }, "devDependencies": { - "aegir": "^37.0.11", - "multiformats": "^9.5.1" + "aegir": "^37.11.0", + "multiformats": "^11.0.0" }, "browser": { "worker_threads": false diff --git a/packages/ipfs-message-port-server/src/core.js b/packages/ipfs-message-port-server/src/core.js index 50c8aa618e..5a2a39cee5 100644 --- a/packages/ipfs-message-port-server/src/core.js +++ b/packages/ipfs-message-port-server/src/core.js @@ -9,7 +9,7 @@ import { import { decodeCID, encodeCID } from 'ipfs-message-port-protocol/cid' /** - * @typedef {import('multiformats/cid').CIDVersion} CIDVersion + * @typedef {import('multiformats/cid').Version} CIDVersion * @typedef {import('ipfs-core-types').IPFS} IPFS * @typedef {import('ipfs-core-types/src/root').AddOptions} AddOptions * @typedef {import('ipfs-core-types/src/root').AddAllOptions} AddAllOptions diff --git a/packages/ipfs/.aegir.js b/packages/ipfs/.aegir.js index 4d424964be..768a934ce9 100644 --- a/packages/ipfs/.aegir.js +++ b/packages/ipfs/.aegir.js @@ -9,17 +9,7 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url)) /** @type {import('aegir').Options["build"]["config"]} */ const esbuild = { - inject: [path.join(__dirname, '../../scripts/node-globals.js')], - plugins: [ - { - name: 'node built ins', - setup (build) { - build.onResolve({ filter: /^stream$/ }, () => { - return { path: require.resolve('readable-stream') } - }) - } - } - ] + inject: [path.join(__dirname, '../../scripts/node-globals.js')] } /** @type {import('aegir').PartialOptions} */ diff --git a/packages/ipfs/CHANGELOG.md b/packages/ipfs/CHANGELOG.md index aa06d69534..53ab9e64bb 100644 --- a/packages/ipfs/CHANGELOG.md +++ b/packages/ipfs/CHANGELOG.md @@ -4,6 +4,55 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.66.0](https://www.github.com/ipfs/js-ipfs/compare/ipfs-v0.65.0...ipfs-v0.66.0) (2023-01-11) + + +### ⚠ BREAKING CHANGES + +* update multiformats to v11.x.x and related depenendcies (#4277) + +### Bug Fixes + +* update multiformats to v11.x.x and related depenendcies ([#4277](https://www.github.com/ipfs/js-ipfs/issues/4277)) ([521c84a](https://www.github.com/ipfs/js-ipfs/commit/521c84a958b04d61702577a5adce28519c1b2a3b)) +* use aegir to publish RCs ([#4284](https://www.github.com/ipfs/js-ipfs/issues/4284)) ([6d90cbf](https://www.github.com/ipfs/js-ipfs/commit/6d90cbf321a7dbf4b1084ba20f0c514dc08d8d0a)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * ipfs-cli bumped from ^0.15.0 to ^0.16.0 + * ipfs-core bumped from ^0.17.0 to ^0.18.0 + * devDependencies + * interface-ipfs-core bumped from ^0.157.0 to ^0.158.0 + * ipfs-client bumped from ^0.9.2 to ^0.10.0 + * ipfs-core-types bumped from ^0.13.0 to ^0.14.0 + * ipfs-http-client bumped from ^59.0.0 to ^60.0.0 + +## [0.65.0](https://www.github.com/ipfs/js-ipfs/compare/ipfs-v0.64.2...ipfs-v0.65.0) (2022-10-24) + + +### ⚠ BREAKING CHANGES + +* ipfs is now bundled with libp2p@0.40.x which has different config + +### Features + +* upgrade libp2p to 0.40.x ([#4237](https://www.github.com/ipfs/js-ipfs/issues/4237)) ([0cee4a4](https://www.github.com/ipfs/js-ipfs/commit/0cee4a4c55767022584dcbade0b0b9b43326f9c9)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * ipfs-cli bumped from ^0.14.2 to ^0.15.0 + * ipfs-core bumped from ^0.16.1 to ^0.17.0 + * devDependencies + * interface-ipfs-core bumped from ^0.156.1 to ^0.157.0 + * ipfs-client bumped from ^0.9.1 to ^0.9.2 + * ipfs-core-types bumped from ^0.12.1 to ^0.13.0 + * ipfs-http-client bumped from ^58.0.1 to ^59.0.0 + ### [0.64.2](https://www.github.com/ipfs/js-ipfs/compare/ipfs-v0.64.1...ipfs-v0.64.2) (2022-09-21) diff --git a/packages/ipfs/README.md b/packages/ipfs/README.md index 37f6f857b2..1219fb338a 100644 --- a/packages/ipfs/README.md +++ b/packages/ipfs/README.md @@ -1,10 +1,9 @@ # ipfs -[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io) -[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) -[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs) +[![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech) +[![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech) [![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs) -[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/js-test-and-release.yml) +[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/js-ipfs/test.yml?branch=master\&style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/test.yml?query=branch%3Amaster) > JavaScript implementation of the IPFS specification diff --git a/packages/ipfs/package.json b/packages/ipfs/package.json index 5f3f4281ca..766c725f60 100644 --- a/packages/ipfs/package.json +++ b/packages/ipfs/package.json @@ -1,6 +1,6 @@ { "name": "ipfs", - "version": "0.64.2", + "version": "0.66.0", "description": "JavaScript implementation of the IPFS specification", "license": "Apache-2.0 OR MIT", "homepage": "https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs#readme", @@ -70,38 +70,41 @@ "test:interface:client": "aegir test -f test/interface-client.js", "test:interface:http-js": "aegir test -f test/interface-http-js.js", "test:interface:http-go": "aegir test -f test/interface-http-go.js", - "test:interop": "cross-env DEBUG=$DEBUG IPFS_LOGGING=$IPFS_LOGGING IPFS_JS_EXEC=$PWD/src/cli.js LIBP2P_TCP_REUSEPORT=false ipfs-interop", + "test:interop": "cross-env DEBUG=$DEBUG IPFS_LOGGING=$IPFS_LOGGING IPFS_JS_EXEC=$PWD/src/cli.js KUBO_RPC_MODULE=$PWD/../ipfs-http-client/src/index.js LIBP2P_TCP_REUSEPORT=false ipfs-interop", "test:external": "aegir test-dependant", "clean": "aegir clean", "dep-check": "aegir dep-check -i ipfs-core-types -i @types/*" }, "dependencies": { - "@libp2p/logger": "^2.0.0", - "ipfs-cli": "^0.14.2", - "ipfs-core": "^0.16.1", + "@libp2p/logger": "^2.0.5", + "ipfs-cli": "^0.16.0", + "ipfs-core": "^0.18.0", "semver": "^7.3.2", "update-notifier": "^6.0.0" }, "devDependencies": { - "@libp2p/webrtc-star-signalling-server": "^2.0.1", - "@libp2p/websockets": "^3.0.0", + "@libp2p/webrtc-star-signalling-server": "^3.0.0", + "@libp2p/websockets": "^5.0.0", "@types/semver": "^7.3.4", "@types/update-notifier": "^6.0.1", - "aegir": "^37.0.11", + "aegir": "^37.11.0", "cross-env": "^7.0.0", - "electron-webrtc": "^0.3.0", - "go-ipfs": "^0.12.1", - "interface-ipfs-core": "^0.156.1", - "ipfs-client": "^0.9.1", - "ipfs-core-types": "^0.12.1", - "ipfs-http-client": "^58.0.1", - "ipfs-interop": "^9.0.1", - "ipfs-utils": "^9.0.6", - "ipfsd-ctl": "^12.0.3", + "go-ipfs": "^0.12.0", + "interface-ipfs-core": "^0.158.0", + "ipfs-client": "^0.10.0", + "ipfs-core-types": "^0.14.0", + "ipfs-http-client": "^60.0.0", + "ipfs-interop": "^10.0.0", + "ipfs-utils": "^9.0.13", + "ipfsd-ctl": "^13.0.0", "iso-url": "^1.0.0", + "kubo-rpc-client": "^3.0.0", "merge-options": "^3.0.4", "mock-ipfs-pinning-service": "^0.4.2", - "url": "^0.11.0", + "url": "^0.11.0" + }, + "optionalDependencies": { + "electron-webrtc": "^0.3.0", "wrtc": "^0.4.6" }, "browser": { diff --git a/packages/ipfs/test/utils/factory.js b/packages/ipfs/test/utils/factory.js index 9d3ec48789..eb435572cc 100644 --- a/packages/ipfs/test/utils/factory.js +++ b/packages/ipfs/test/utils/factory.js @@ -7,7 +7,7 @@ import * as ipfsModule from 'ipfs-core' import goIpfs from 'go-ipfs' import path, { dirname } from 'path' import { fileURLToPath } from 'url' -import { WebSockets } from '@libp2p/websockets' +import { webSockets } from '@libp2p/websockets' import { all as WebSocketsFiltersAll } from '@libp2p/websockets/filters' const merge = mergeOpts.bind({ ignoreUndefined: true }) @@ -29,7 +29,7 @@ const commonOptions = { dialTimeout: 60e3 // increase timeout because travis is slow }, transports: [ - new WebSockets({ + webSockets({ filter: WebSocketsFiltersAll }) ]