Skip to content

Commit

Permalink
Merge branch 'main' into fix-duplicate-blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
jtsmedley authored Jul 22, 2024
2 parents ee666f0 + f16c9ea commit 6ec36e3
Show file tree
Hide file tree
Showing 29 changed files with 42 additions and 34 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
node-version: ${{ matrix.node }}
- uses: ipfs/aegir/actions/cache-node-modules@master
- run: npm run --if-present test:node
- uses: codecov/codecov-action@125fc84a9a348dbcf27191600683ec096ec9021c # v4.4.1
- uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
with:
flags: node
files: .coverage/*,packages/*/.coverage/*
Expand All @@ -62,7 +62,7 @@ jobs:
node-version: lts/*
- uses: ipfs/aegir/actions/cache-node-modules@master
- run: npm run --if-present test:chrome
- uses: codecov/codecov-action@125fc84a9a348dbcf27191600683ec096ec9021c # v4.4.1
- uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
with:
flags: chrome
files: .coverage/*,packages/*/.coverage/*
Expand All @@ -78,7 +78,7 @@ jobs:
node-version: lts/*
- uses: ipfs/aegir/actions/cache-node-modules@master
- run: npm run --if-present test:chrome-webworker
- uses: codecov/codecov-action@125fc84a9a348dbcf27191600683ec096ec9021c # v4.4.1
- uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
with:
flags: chrome-webworker
files: .coverage/*,packages/*/.coverage/*
Expand All @@ -94,7 +94,7 @@ jobs:
node-version: lts/*
- uses: ipfs/aegir/actions/cache-node-modules@master
- run: npm run --if-present test:firefox
- uses: codecov/codecov-action@125fc84a9a348dbcf27191600683ec096ec9021c # v4.4.1
- uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
with:
flags: firefox
files: .coverage/*,packages/*/.coverage/*
Expand All @@ -110,7 +110,7 @@ jobs:
node-version: lts/*
- uses: ipfs/aegir/actions/cache-node-modules@master
- run: npm run --if-present test:firefox-webworker
- uses: codecov/codecov-action@125fc84a9a348dbcf27191600683ec096ec9021c # v4.4.1
- uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
with:
flags: firefox-webworker
files: .coverage/*,packages/*/.coverage/*
Expand All @@ -126,7 +126,7 @@ jobs:
node-version: lts/*
- uses: ipfs/aegir/actions/cache-node-modules@master
- run: npm run --if-present test:webkit
- uses: codecov/codecov-action@125fc84a9a348dbcf27191600683ec096ec9021c # v4.4.1
- uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
with:
flags: webkit
files: .coverage/*,packages/*/.coverage/*
Expand All @@ -142,7 +142,7 @@ jobs:
node-version: lts/*
- uses: ipfs/aegir/actions/cache-node-modules@master
- run: npx xvfb-maybe npm run --if-present test:electron-main
- uses: codecov/codecov-action@125fc84a9a348dbcf27191600683ec096ec9021c # v4.4.1
- uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
with:
flags: electron-main
files: .coverage/*,packages/*/.coverage/*
Expand All @@ -158,7 +158,7 @@ jobs:
node-version: lts/*
- uses: ipfs/aegir/actions/cache-node-modules@master
- run: npx xvfb-maybe npm run --if-present test:electron-renderer
- uses: codecov/codecov-action@125fc84a9a348dbcf27191600683ec096ec9021c # v4.4.1
- uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
with:
flags: electron-renderer
files: .coverage/*,packages/*/.coverage/*
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/add-dir/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@helia/unixfs": "^3.0.4",
"@ipld/dag-pb": "^4.0.2",
"@libp2p/websockets": "^8.0.9",
"aegir": "^42.1.0",
"aegir": "^43.0.1",
"blockstore-fs": "^1.0.1",
"datastore-level": "^10.0.1",
"execa": "^8.0.1",
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/gc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"devDependencies": {
"@ipld/dag-pb": "^4.0.6",
"aegir": "^42.2.5",
"aegir": "^43.0.1",
"blockstore-fs": "^1.1.8",
"datastore-level": "^10.1.5",
"execa": "^8.0.1",
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/transfer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@helia/unixfs": "^3.0.3",
"@ipld/dag-pb": "^4.0.2",
"@libp2p/websockets": "^8.0.19",
"aegir": "^42.2.5",
"aegir": "^43.0.1",
"blockstore-fs": "^1.0.1",
"datastore-level": "^10.0.1",
"execa": "^8.0.1",
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/transports/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"dependencies": {
"@chainsafe/libp2p-noise": "^15.0.0",
"@chainsafe/libp2p-yamux": "^6.0.2",
"@helia/block-brokers": "^2.1.1",
"@helia/block-brokers": "^3.0.2",
"@helia/routers": "^1.0.3",
"@helia/unixfs": "^3.0.3",
"@ipld/dag-pb": "^4.1.0",
Expand All @@ -27,7 +27,7 @@
"@libp2p/websockets": "^8.0.19",
"@libp2p/webtransport": "^4.0.29",
"@multiformats/multiaddr": "^12.2.1",
"aegir": "^42.2.5",
"aegir": "^43.0.1",
"blockstore-fs": "^1.1.10",
"blockstore-idb": "^1.1.8",
"datastore-idb": "^2.1.9",
Expand Down
2 changes: 1 addition & 1 deletion packages/bitswap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ $ npm i @helia/bitswap

## Browser `<script>` tag

Loading this module through a script tag will make it's exports available as `HeliaBitswap` in the global namespace.
Loading this module through a script tag will make its exports available as `HeliaBitswap` in the global namespace.

```html
<script src="https://unpkg.com/@helia/bitswap/dist/index.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion packages/bitswap/src/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ export class Network extends TypedEventEmitter<NetworkEvents> {
* Find bitswap providers for a given `cid`.
*/
async * findProviders (cid: CID, options?: AbortOptions & ProgressOptions<BitswapNetworkWantProgressEvents>): AsyncIterable<Provider> {
options?.onProgress?.(new CustomProgressEvent<PeerId>('bitswap:network:find-providers', cid))
options?.onProgress?.(new CustomProgressEvent<CID>('bitswap:network:find-providers', cid))

for await (const provider of this.routing.findProviders(cid, options)) {
// make sure we can dial the provider
Expand Down
2 changes: 1 addition & 1 deletion packages/block-brokers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ $ npm i @helia/block-brokers

## Browser `<script>` tag

Loading this module through a script tag will make it's exports available as `HeliaBlockBrokers` in the global namespace.
Loading this module through a script tag will make its exports available as `HeliaBlockBrokers` in the global namespace.

```html
<script src="https://unpkg.com/@helia/block-brokers/dist/index.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion packages/car/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ $ npm i @helia/car

## Browser `<script>` tag

Loading this module through a script tag will make it's exports available as `HeliaCar` in the global namespace.
Loading this module through a script tag will make its exports available as `HeliaCar` in the global namespace.

```html
<script src="https://unpkg.com/@helia/car/dist/index.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion packages/dag-cbor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ $ npm i @helia/dag-cbor

## Browser `<script>` tag

Loading this module through a script tag will make it's exports available as `HeliaDagCbor` in the global namespace.
Loading this module through a script tag will make its exports available as `HeliaDagCbor` in the global namespace.

```html
<script src="https://unpkg.com/@helia/dag-cbor/dist/index.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion packages/dag-json/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ $ npm i @helia/dag-json

## Browser `<script>` tag

Loading this module through a script tag will make it's exports available as `HeliaDagJson` in the global namespace.
Loading this module through a script tag will make its exports available as `HeliaDagJson` in the global namespace.

```html
<script src="https://unpkg.com/@helia/dag-json/dist/index.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion packages/helia/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ $ npm i helia

## Browser `<script>` tag

Loading this module through a script tag will make it's exports available as `Helia` in the global namespace.
Loading this module through a script tag will make its exports available as `Helia` in the global namespace.

```html
<script src="https://unpkg.com/helia/dist/index.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion packages/helia/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export interface HeliaInit<T extends Libp2p = Libp2p> extends HeliaClassInit {
* The libp2p `start` option is not supported, instead please pass `start` in
* the root of the HeliaInit object.
*/
libp2p?: T | Omit<Libp2pOptions, 'start'>
libp2p?: T | Omit<Libp2pOptions<any>, 'start'>

/**
* Pass `false` to not start the Helia node
Expand Down
2 changes: 1 addition & 1 deletion packages/helia/src/utils/libp2p-defaults.browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export interface DefaultLibp2pServices extends Record<string, unknown> {
ping: PingService
}

export function libp2pDefaults (options: Libp2pDefaultsOptions = {}): Libp2pOptions<DefaultLibp2pServices> {
export function libp2pDefaults (options: Libp2pDefaultsOptions = {}): Libp2pOptions<DefaultLibp2pServices> & Required<Pick<Libp2pOptions<DefaultLibp2pServices>, 'services'>> {
const agentVersion = `${name}/${version} ${libp2pInfo.name}/${libp2pInfo.version} UserAgent=${globalThis.navigator.userAgent}`

return {
Expand Down
2 changes: 1 addition & 1 deletion packages/helia/src/utils/libp2p-defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export interface DefaultLibp2pServices extends Record<string, unknown> {
upnp: unknown
}

export function libp2pDefaults (options: Libp2pDefaultsOptions = {}): Libp2pOptions<DefaultLibp2pServices> {
export function libp2pDefaults (options: Libp2pDefaultsOptions = {}): Libp2pOptions<DefaultLibp2pServices> & Required<Pick<Libp2pOptions<DefaultLibp2pServices>, 'services'>> {
const agentVersion = `${name}/${version} ${libp2pInfo.name}/${libp2pInfo.version} UserAgent=${process.version}`

return {
Expand Down
2 changes: 2 additions & 0 deletions packages/helia/test/libp2p.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ describe('libp2p', () => {

it('allows overriding libp2p config', async () => {
const config = {
addresses: {},
transports: [],
services: {}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/http/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ $ npm i @helia/http

## Browser `<script>` tag

Loading this module through a script tag will make it's exports available as `HeliaHttp` in the global namespace.
Loading this module through a script tag will make its exports available as `HeliaHttp` in the global namespace.

```html
<script src="https://unpkg.com/@helia/http/dist/index.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion packages/interface/src/blocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export interface BlockRetrievalOptions <ProgressEvents extends ProgressEvent<any
/**
* A function that blockBrokers should call prior to returning a block to ensure it can maintain control
* of the block request flow. e.g. TrustedGatewayBlockBroker will use this to ensure that the block
* is valid from one of the gateways before assuming it's work is done. If the block is not valid, it should try another gateway
* is valid from one of the gateways before assuming its work is done. If the block is not valid, it should try another gateway
* and WILL consider the gateway that returned the invalid blocks completely unreliable.
*/
validateFn?(block: Uint8Array): Promise<void>
Expand Down
2 changes: 1 addition & 1 deletion packages/interop/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ $ npm i @helia/interop

## Browser `<script>` tag

Loading this module through a script tag will make it's exports available as `HeliaInterop` in the global namespace.
Loading this module through a script tag will make its exports available as `HeliaInterop` in the global namespace.

```html
<script src="https://unpkg.com/@helia/interop/dist/index.min.js"></script>
Expand Down
3 changes: 3 additions & 0 deletions packages/interop/src/fixtures/create-helia.browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,11 @@ export async function createHeliaNode (libp2pOptions?: Libp2pOptions): Promise<H
defaults.peerDiscovery = []

// remove services that are not used in tests
// @ts-expect-error services.autoNAT is not optional
delete defaults.services.autoNAT
// @ts-expect-error services.dcutr is not optional
delete defaults.services.dcutr
// @ts-expect-error services.delegatedRouting is not optional
delete defaults.services.delegatedRouting

return createHelia<Libp2p<DefaultLibp2pServices>>({
Expand Down
3 changes: 3 additions & 0 deletions packages/interop/src/fixtures/create-helia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,11 @@ export async function createHeliaNode (libp2pOptions?: Libp2pOptions): Promise<H
defaults.peerDiscovery = []

// remove services that are not used in tests
// @ts-expect-error services.autoNAT is not optional
delete defaults.services.autoNAT
// @ts-expect-error services.dcutr is not optional
delete defaults.services.dcutr
// @ts-expect-error services.delegatedRouting is not optional
delete defaults.services.delegatedRouting

return createHelia<Libp2p<DefaultLibp2pServices>>({
Expand Down
2 changes: 1 addition & 1 deletion packages/ipns/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ $ npm i @helia/ipns

## Browser `<script>` tag

Loading this module through a script tag will make it's exports available as `HeliaIpns` in the global namespace.
Loading this module through a script tag will make its exports available as `HeliaIpns` in the global namespace.

```html
<script src="https://unpkg.com/@helia/ipns/dist/index.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion packages/json/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ $ npm i @helia/json

## Browser `<script>` tag

Loading this module through a script tag will make it's exports available as `HeliaJson` in the global namespace.
Loading this module through a script tag will make its exports available as `HeliaJson` in the global namespace.

```html
<script src="https://unpkg.com/@helia/json/dist/index.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion packages/mfs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ $ npm i @helia/mfs

## Browser `<script>` tag

Loading this module through a script tag will make it's exports available as `HeliaMfs` in the global namespace.
Loading this module through a script tag will make its exports available as `HeliaMfs` in the global namespace.

```html
<script src="https://unpkg.com/@helia/mfs/dist/index.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion packages/routers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ $ npm i @helia/routers

## Browser `<script>` tag

Loading this module through a script tag will make it's exports available as `HeliaRouters` in the global namespace.
Loading this module through a script tag will make its exports available as `HeliaRouters` in the global namespace.

```html
<script src="https://unpkg.com/@helia/routers/dist/index.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion packages/strings/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ $ npm i @helia/strings

## Browser `<script>` tag

Loading this module through a script tag will make it's exports available as `HeliaStrings` in the global namespace.
Loading this module through a script tag will make its exports available as `HeliaStrings` in the global namespace.

```html
<script src="https://unpkg.com/@helia/strings/dist/index.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion packages/unixfs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ $ npm i @helia/unixfs

## Browser `<script>` tag

Loading this module through a script tag will make it's exports available as `HeliaUnixfs` in the global namespace.
Loading this module through a script tag will make its exports available as `HeliaUnixfs` in the global namespace.

```html
<script src="https://unpkg.com/@helia/unixfs/dist/index.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ $ npm i @helia/utils

## Browser `<script>` tag

Loading this module through a script tag will make it's exports available as `HeliaUtils` in the global namespace.
Loading this module through a script tag will make its exports available as `HeliaUtils` in the global namespace.

```html
<script src="https://unpkg.com/@helia/utils/dist/index.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ export class Helia implements HeliaInterface {
yield cid

options.onProgress?.(new CustomProgressEvent<CID>('helia:gc:deleted', cid))
} catch (err) {
} catch (err: any) {
helia.log.error('Error during gc', err)
options.onProgress?.(new CustomProgressEvent<Error>('helia:gc:error', err))
}
Expand Down

0 comments on commit 6ec36e3

Please sign in to comment.