Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: add @helia/http to monorepo #372

Merged
merged 20 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions packages/block-brokers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,24 +55,15 @@
"dependencies": {
"@helia/interface": "^3.0.0",
"@libp2p/interface": "^1.1.1",
"any-signal": "^4.1.1",
"interface-blockstore": "^5.2.7",
"interface-store": "^5.1.5",
"ipfs-bitswap": "^20.0.0",
"it-filter": "^3.0.4",
"it-foreach": "^2.0.6",
"multiformats": "^13.0.0",
"progress-events": "^1.0.0",
"uint8arrays": "^5.0.1"
"progress-events": "^1.0.0"
},
"devDependencies": {
"@libp2p/logger": "^4.0.1",
"@types/sinon": "^17.0.2",
"aegir": "^42.1.0",
"blockstore-core": "^4.3.8",
"delay": "^6.0.0",
"it-all": "^3.0.4",
"it-drain": "^3.0.5",
"sinon": "^17.0.1",
"sinon-ts": "^2.0.0"
}
Expand Down
1 change: 0 additions & 1 deletion packages/block-brokers/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export { bitswap } from './bitswap.js'
export { trustlessGateway } from './trustless-gateway/index.js'
export { NetworkedStorage } from './utils/networked-storage.js'
2 changes: 1 addition & 1 deletion packages/car/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
"dependencies": {
"@helia/interface": "^3.0.0",
"@ipld/car": "^5.1.1",
"@ipld/dag-pb": "^4.0.3",
"@ipld/dag-pb": "^4.0.6",
"@libp2p/interfaces": "^3.3.1",
"cborg": "^4.0.3",
"it-drain": "^3.0.5",
Expand Down
79 changes: 79 additions & 0 deletions packages/core/.aegir.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import { circuitRelayServer } from '@libp2p/circuit-relay-v2'
import { identify } from '@libp2p/identify'
import { WebSockets } from '@multiformats/mafmt'
import { CID } from 'multiformats/cid'
import { sha256 } from 'multiformats/hashes/sha2'
import * as raw from 'multiformats/codecs/raw'
import { createLibp2p } from 'libp2p'
import { webSockets } from '@libp2p/websockets'
import { yamux } from '@chainsafe/libp2p-yamux'
import { noise } from '@chainsafe/libp2p-noise'

/** @type {import('aegir').PartialOptions} */
const options = {
test: {
before: async () => {
// use dynamic import otherwise the source may not have been built yet
const { createHelia } = await import('./dist/test/fixtures/create-helia.js')
const { bitswap } = await import('@helia/block-brokers')

const helia = await createHelia({
blockBrokers: [
bitswap()
],
libp2p: await createLibp2p({
addresses: {
listen: [
'/ip4/127.0.0.1/tcp/0/ws'
]
},
connectionManager: {
inboundConnectionThreshold: Infinity,
minConnections: 0
},
transports: [
webSockets()
],
streamMuxers: [
yamux()
],
connectionEncryption: [
noise()
],
services: {
identify: identify(),
relay: circuitRelayServer({
reservations: {
maxReservations: Infinity,
applyDefaultLimit: false
}
})
}
})
})

const block = Uint8Array.from([0, 1, 2, 3])
const mh = await sha256.digest(block)
const cid = CID.createV1(raw.code, mh)
await helia.blockstore.put(cid, block)

return {
env: {
RELAY_SERVER: helia.libp2p.getMultiaddrs()
.filter(ma => WebSockets.matches(ma))
.map(ma => ma.toString())
.pop(),
BLOCK_CID: cid.toString()
},
helia
}
},
after: async (_, beforeResult) => {
if (beforeResult.helia != null) {
await beforeResult.helia.stop()
}
}
}
}

export default options
Loading
Loading