Skip to content

Commit

Permalink
deps!: update to libp2p@0.38.x (#4151)
Browse files Browse the repository at this point in the history
Updates all dependencies to allow use of `libp2p@0.38.x`.  See the [release issue](libp2p/js-libp2p#1253) for what's new!
  • Loading branch information
achingbrain authored Aug 17, 2022
1 parent 842a7db commit 43ba607
Show file tree
Hide file tree
Showing 7 changed files with 159 additions and 219 deletions.
4 changes: 4 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
This project is dual licensed under MIT and Apache-2.0.

MIT: https://www.opensource.org/licenses/mit
Apache-2.0: https://www.apache.org/licenses/license-2.0
11 changes: 4 additions & 7 deletions LICENSE-MIT
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
The MIT License (MIT)

Copyright (c) 2016 Protocol Labs, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
157 changes: 84 additions & 73 deletions README.md

Large diffs are not rendered by default.

175 changes: 46 additions & 129 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,49 @@
"name": "ipfs-http-client",
"version": "57.0.3",
"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",
"repository": {
"type": "git",
"url": "git+https://github.com/ipfs/js-ipfs.git"
},
"bugs": {
"url": "https://github.com/ipfs/js-ipfs/issues"
},
"keywords": [
"ipfs"
],
"homepage": "https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-http-client#readme",
"bugs": "https://github.com/ipfs/js-ipfs/issues",
"license": "(Apache-2.0 OR MIT)",
"engines": {
"node": ">=16.0.0",
"npm": ">=7.0.0"
},
"type": "module",
"types": "dist/src/index.d.ts",
"types": "./dist/src/index.d.ts",
"typesVersions": {
"*": {
"*": [
"*",
"dist/*",
"dist/src/*",
"dist/src/*/index"
],
"src/*": [
"*",
"dist/*",
"dist/src/*",
"dist/src/*/index"
]
}
},
"files": [
"dist",
"src",
"dist",
"!dist/test",
"!**/*.tsbuildinfo"
],
"exports": {
".": {
"types": "./dist/src/index.d.ts",
"import": "./src/index.js"
}
},
Expand All @@ -26,17 +54,6 @@
"sourceType": "module"
}
},
"browser": {
"ipfs-utils/src/files/glob-source": false,
"go-ipfs": false,
"ipfs-core-utils/src/files/normalise-input": "ipfs-core-utils/src/files/normalise-input/index.browser.js",
"http": false,
"https": false
},
"repository": {
"type": "git",
"url": "git+https://github.com/ipfs/js-ipfs.git"
},
"scripts": {
"build": "aegir build",
"test": "aegir test",
Expand All @@ -53,18 +70,18 @@
"@ipld/dag-cbor": "^7.0.0",
"@ipld/dag-json": "^8.0.1",
"@ipld/dag-pb": "^2.1.3",
"@libp2p/logger": "^1.1.4",
"@libp2p/logger": "^2.0.0",
"@libp2p/peer-id": "^1.1.10",
"@multiformats/multiaddr": "^10.1.8",
"any-signal": "^3.0.0",
"dag-jose": "^1.0.0",
"dag-jose": "^2.0.1",
"err-code": "^3.0.1",
"ipfs-core-types": "^0.11.1",
"ipfs-core-utils": "^0.15.1",
"ipfs-core-types": "^0.11.0",
"ipfs-core-utils": "^0.15.0",
"ipfs-utils": "^9.0.6",
"it-first": "^1.0.6",
"it-last": "^1.0.4",
"merge-options": "^3.0.4",
"@multiformats/multiaddr": "^10.0.0",
"multiformats": "^9.5.1",
"parse-duration": "^1.0.0",
"stream-to-it": "^0.2.2",
Expand All @@ -74,117 +91,17 @@
"aegir": "^37.0.11",
"delay": "^5.0.0",
"go-ipfs": "^0.12.1",
"ipfsd-ctl": "^11.0.0",
"ipfsd-ctl": "^12.0.0",
"it-all": "^1.0.4",
"it-first": "^1.0.4",
"nock": "^13.0.2",
"p-defer": "^4.0.0"
},
"engines": {
"node": ">=15.0.0",
"npm": ">=3.0.0"
},
"contributors": [
"Alan Shaw <alan.shaw@protocol.ai>",
"Alan Shaw <alan@tableflip.io>",
"Alex Mingoia <talk@alexmingoia.com>",
"Alex Potsides <alex@achingbrain.net>",
"Antonio Tenorio-Fornés <antoniotenorio@ucm.es>",
"Bruno Barbieri <bbarbieri@delivery.com>",
"Clemo <flipflopsimsommer@users.noreply.github.com>",
"Connor Keenan <ckeenan89@gmail.com>",
"Daniel Constantin <hello@danielconstantin.net>",
"Danny <dannyid@protonmail.com>",
"David Braun <David.Braun@Toptal.com>",
"David Dias <daviddias.p@gmail.com>",
"Dietrich Ayala <autonome@gmail.com>",
"Diogo Silva <fsdiogo@gmail.com>",
"Dmitriy Ryajov <dryajov@gmail.com>",
"Dmitry Nikulin <dmitr-nikulin@mail.ru>",
"Donatas Stundys <donatas.stundys@necolt.com>",
"Fil <fil@rezo.net>",
"Filip Š <filip.stamcar@hotmail.com>",
"Francisco Baio Dias <xicombd@gmail.com>",
"Friedel Ziegelmayer <dignifiedquire@gmail.com>",
"Gar <gar+gh@danger.computer>",
"Gavin McDermott <gavinmcdermott@gmail.com>",
"Gopalakrishna Palem <KrishnaPG@users.noreply.github.com>",
"Greenkeeper <support@greenkeeper.io>",
"Haad <haadcode@users.noreply.github.com>",
"Harlan T Wood <harlantwood@users.noreply.github.com>",
"Harlan T Wood <code@harlantwood.net>",
"Henrique Dias <hacdias@gmail.com>",
"Holodisc <holodiscent@gmail.com>",
"Hugo Dias <hugomrdias@gmail.com>",
"Hugo Dias <mail@hugodias.me>",
"JGAntunes <j.goncalo.antunes@gmail.com>",
"Jacob Heun <jacobheun@gmail.com>",
"James Halliday <substack@gmail.com>",
"Jason Carver <jacarver@linkedin.com>",
"Jason Papakostas <vith@users.noreply.github.com>",
"Jeff Downie <JeffDownie@users.noreply.github.com>",
"Jeromy <why@ipfs.io>",
"Jeromy <jeromyj@gmail.com>",
"Jim Pick <jim@protocol.ai>",
"Joe Turgeon <arithmetric@gmail.com>",
"Jonathan <jkrone@vt.edu>",
"Juan Batiz-Benet <juan@benet.ai>",
"Kevin Wang <kevin@fossa.io>",
"Kristoffer Ström <kristoffer@rymdkoloni.se>",
"Marcin Rataj <lidel@lidel.org>",
"Matt Bell <mappum@gmail.com>",
"Matt Ober <matt.ober3@gmail.com>",
"Maxime Lathuilière <k@maxlath.eu>",
"Michael Bradley <michaelsbradleyjr@gmail.com>",
"Michael Muré <michael.mure@consensys.net>",
"Michael Muré <batolettre@gmail.com>",
"Mikeal Rogers <mikeal.rogers@gmail.com>",
"Mitar <mitar.git@tnode.com>",
"Mithgol <getgit@mithgol.ru>",
"Mohamed Abdulaziz <mohamed@mohamedabdulaziz.com>",
"Nitin Patel <31539366+niinpatel@users.noreply.github.com>",
"Nuno Nogueira <nunofmn@gmail.com>",
"Níckolas Goline <nickolas.goline@gmail.com>",
"Oli Evans <oli@tableflip.io>",
"Orie Steele <orie@ohs.io>",
"Paul Cowgill <pauldavidcowgill@gmail.com>",
"Pedro Santos <pedro.santos@moxy.studio>",
"Pedro Santos <pedromiguelsousasantos@hotmail.com>",
"Pedro Teixeira <i@pgte.me>",
"Pete Thomas <pete@xminusone.net>",
"Richard Littauer <richard.littauer@gmail.com>",
"Richard Schneider <makaretu@gmail.com>",
"Roman Khafizianov <requilence@gmail.com>",
"SeungWon <ksw3894@gmail.com>",
"Stephen Whitmore <stephen.whitmore@gmail.com>",
"Tara Vancil <tbvanc@gmail.com>",
"Teri Chadbourne <terichadbourne@users.noreply.github.com>",
"Travis Person <travis@protocol.ai>",
"Travis Person <travis.person@gmail.com>",
"Vasco Santos <vasco.santos@ua.pt>",
"Vasco Santos <vasco.santos@moxy.studio>",
"Victor Bjelkholm <victor@typeform.com>",
"Volker Mische <volker.mische@gmail.com>",
"Zhiyuan Lin <edsgerlin@gmail.com>",
"dirkmc <dirkmdev@gmail.com>",
"dmitriy ryajov <dryajov@dmitriys-MacBook-Pro.local>",
"elsehow <yes@cosmopol.is>",
"ethers <ethereum@outlook.com>",
"greenkeeper[bot] <23040076+greenkeeper[bot]@users.noreply.github.com>",
"greenkeeper[bot] <greenkeeper[bot]@users.noreply.github.com>",
"haad <haad@headbanggames.com>",
"kumavis <kumavis@users.noreply.github.com>",
"leekt216 <leekt216@gmail.com>",
"nginnever <ginneversource@gmail.com>",
"noah the goodra <peterpan0413@live.com>",
"phillmac <phillmac@users.noreply.github.com>",
"priecint <tp-dev@seznam.cz>",
"samuli <samuli@nugg.ad>",
"sarthak khandelwal <sarthak0906@gmail.com>",
"shunkin <hiyoko.san.ipod@gmail.com>",
"victorbjelkholm <victorbjelkholm@gmail.com>",
"Łukasz Magiera <magik6k@users.noreply.github.com>",
"Łukasz Magiera <magik6k@gmail.com>",
"Xmader <xmader@outlook.com>"
]
"browser": {
"ipfs-utils/src/files/glob-source": false,
"go-ipfs": false,
"ipfs-core-utils/src/files/normalise-input": "ipfs-core-utils/src/files/normalise-input/index.browser.js",
"http": false,
"https": false
}
}
4 changes: 2 additions & 2 deletions src/dht/map-event.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { Multiaddr } from '@multiformats/multiaddr'
import { peerIdFromString } from '@libp2p/peer-id'

/**
* @typedef {import('@libp2p/interfaces/peer-id').PeerId} PeerId
* @typedef {import('@libp2p/interface-peer-id').PeerId} PeerId
*/

/**
Expand Down Expand Up @@ -46,7 +46,7 @@ export const mapEvent = (event) => {

if (event.Type === FinalPeer) {
// dht.query ends with a FinalPeer event with no Responses
/** @type {import('@libp2p/interfaces/peer-info').PeerInfo} */
/** @type {import('@libp2p/interface-peer-info').PeerInfo} */
let peer = {
// @ts-expect-error go-ipfs does not return this
id: event.ID ?? peerIdFromString(event.ID),
Expand Down
25 changes: 18 additions & 7 deletions src/pubsub/subscribe.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const log = logger('ipfs-http-client:pubsub:subscribe')

/**
* @typedef {import('../types').HTTPClientExtraOptions} HTTPClientExtraOptions
* @typedef {import('@libp2p/interfaces/pubsub').Message} Message
* @typedef {import('@libp2p/interface-pubsub').Message} Message
* @typedef {(err: Error, fatal: boolean, msg?: Message) => void} ErrorHandlerFn
* @typedef {import('ipfs-core-types/src/pubsub').API<HTTPClientExtraOptions & { onError?: ErrorHandlerFn }>} PubsubAPI
* @typedef {import('../types').Options} Options
Expand Down Expand Up @@ -107,12 +107,23 @@ async function readMessages (response, { onMessage, onEnd, onError }) {
continue
}

onMessage({
from: peerIdFromString(msg.from),
data: rpcToBytes(msg.data),
sequenceNumber: rpcToBigInt(msg.seqno),
topic: rpcToText(msg.topicIDs[0])
})
if (msg.from != null && msg.seqno != null) {
onMessage({
type: 'signed',
from: peerIdFromString(msg.from),
data: rpcToBytes(msg.data),
sequenceNumber: rpcToBigInt(msg.seqno),
topic: rpcToText(msg.topicIDs[0]),
key: rpcToBytes(msg.key ?? 'u'),
signature: rpcToBytes(msg.signature ?? 'u')
})
} else {
onMessage({
type: 'unsigned',
data: rpcToBytes(msg.data),
topic: rpcToText(msg.topicIDs[0])
})
}
} catch (/** @type {any} */ err) {
err.message = `Failed to parse pubsub message: ${err.message}`
onError(err, false, msg) // Not fatal
Expand Down
2 changes: 1 addition & 1 deletion src/pubsub/subscription-tracker.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/**
* @typedef {import('@libp2p/interfaces/pubsub').Message} Message
* @typedef {import('@libp2p/interface-pubsub').Message} Message
* @typedef {import('@libp2p/interfaces/events').EventHandler<Message>} MessageHandlerFn
*
* @typedef {object} Subscription
Expand Down

0 comments on commit 43ba607

Please sign in to comment.