Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit 1bf35f8

Browse files
rvaggachingbrain
andauthored
fix: typo in 'multiformats' type defs (#3778)
Fixes: #3776 Co-authored-by: achingbrain <alex@achingbrain.net>
1 parent 8380d71 commit 1bf35f8

File tree

12 files changed

+16
-26
lines changed

12 files changed

+16
-26
lines changed

packages/ipfs-core-types/src/bitswap/index.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { CID } from 'multiformts/cid'
1+
import type { CID } from 'multiformats/cid'
22
import type { AbortOptions } from '../utils'
33

44
export interface API<OptionExtension = {}> {

packages/ipfs-core-types/src/block/index.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AbortOptions, PreloadOptions, IPFSPath } from '../utils'
1+
import { AbortOptions, PreloadOptions } from '../utils'
22
import { CID, CIDVersion } from 'multiformats/cid'
33

44
export interface API<OptionExtension = {}> {
@@ -78,7 +78,7 @@ export interface API<OptionExtension = {}> {
7878
* // Logs: 3739
7979
* ```
8080
*/
81-
stat: (ipfsPath: IPFSPath, options?: AbortOptions & PreloadOptions & OptionExtension) => Promise<StatResult>
81+
stat: (cid: CID, options?: AbortOptions & PreloadOptions & OptionExtension) => Promise<StatResult>
8282
}
8383

8484
export interface PutOptions extends AbortOptions, PreloadOptions {

packages/ipfs-core-types/src/dht/index.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { AbortOptions } from '../utils'
22
import type { Multiaddr } from 'multiaddr'
3-
import type { CID } from 'multiformts/cid'
3+
import type { CID } from 'multiformats/cid'
44

55
export interface API<OptionExtension = {}> {
66
/**

packages/ipfs-core-types/src/name/index.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CID } from 'multiformts/cid'
1+
import { CID } from 'multiformats/cid'
22
import type { AbortOptions } from '../utils'
33
import type { API as PubsubAPI } from './pubsub'
44

packages/ipfs-core-types/src/object/index.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { CID } from 'multiformts/cid'
1+
import type { CID } from 'multiformats/cid'
22
import type { AbortOptions, PreloadOptions } from '../utils'
33
import type { API as PatchAPI } from './patch'
44
import type { PBNode, PBLink } from '@ipld/dag-pb'

packages/ipfs-core-types/src/object/patch/index.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { CID } from 'multiformts/cid'
1+
import type { CID } from 'multiformats/cid'
22
import type { AbortOptions } from '../../utils'
33
import type { PBLink as DAGLink } from '@ipld/dag-pb'
44

packages/ipfs-core-types/src/pin/index.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { AbortOptions, AwaitIterable } from '../utils'
2-
import type { CID } from 'multiformts/cid'
2+
import type { CID } from 'multiformats/cid'
33
import type { API as Remote } from './remote'
44

55
export interface API<OptionExtension = {}> {

packages/ipfs-core-types/src/pin/remote/index.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CID } from 'multiformts/cid'
1+
import { CID } from 'multiformats/cid'
22
import { Multiaddr } from 'multiaddr'
33
import { API as Service } from './service'
44
import { AbortOptions } from '../../utils'

packages/ipfs-core-types/src/repo/index.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { AbortOptions } from '../utils'
2-
import { CID } from 'multiformts/cid'
2+
import { CID } from 'multiformats/cid'
33

44
export interface API<OptionExtension = {}> {
55
/**

packages/ipfs-core-types/src/utils.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CID } from 'multiformts/cid'
1+
import { CID } from 'multiformats/cid'
22
import { Mtime, MtimeLike } from 'ipfs-unixfs'
33

44
export type Entry<Content extends AsyncIterable<Uint8Array>|Blob> =

packages/ipfs-core/src/components/dht.js

+1-12
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,8 @@ module.exports = ({ network, repo }) => {
6565
*/
6666
async * provide (cids, options = { recursive: false }) {
6767
const { libp2p } = await use(network, options)
68-
/** @type {CID[]} */
6968
const cidArr = Array.isArray(cids) ? cids : [cids]
7069

71-
for (const i in cids) {
72-
if (typeof cids[i] === 'string') {
73-
try {
74-
cids[i] = CID.parse(cids[i])
75-
} catch (err) {
76-
throw errCode(err, 'ERR_INVALID_CID')
77-
}
78-
}
79-
}
80-
8170
// ensure blocks are actually local
8271
const hasCids = await Promise.all(cidArr.map(cid => repo.blocks.has(cid)))
8372
const hasAll = hasCids.every(has => has)
@@ -91,7 +80,7 @@ module.exports = ({ network, repo }) => {
9180
throw errCode(new Error('not implemented yet'), 'ERR_NOT_IMPLEMENTED_YET')
9281
}
9382

94-
for (const cid of cids) {
83+
for (const cid of cidArr) {
9584
yield libp2p._dht.provide(cid)
9685
}
9786
},

packages/ipfs-http-server/src/api/resources/object.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -399,9 +399,10 @@ exports.stat = {
399399

400400
const base = await ipfs.bases.getBase(cidBase)
401401

402-
stats.Hash = stats.Hash.toString(base.encoder)
403-
404-
return h.response(stats)
402+
return h.response({
403+
...stats,
404+
Hash: stats.Hash.toString(base.encoder)
405+
})
405406
}
406407
}
407408

0 commit comments

Comments
 (0)