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

Commit 0ef1271

Browse files
committed
chore: upgrade unixfs deps
Upgrades to new version with types
1 parent a153d91 commit 0ef1271

File tree

13 files changed

+1928
-26
lines changed

13 files changed

+1928
-26
lines changed

examples/traverse-ipld-graphs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"cids": "^1.1.5",
1717
"ipfs": "^0.54.2",
1818
"ipld-block": "^0.11.0",
19-
"ipld-dag-pb": "^0.20.0",
19+
"ipld-dag-pb": "ipld/js-ipld-dag-pb#feat/add-types",
2020
"ipld-git": "^0.6.1",
2121
"ipld-ethereum": "^5.0.1",
2222
"multihashing-async": "^2.0.1"

packages/interface-ipfs-core/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@
3939
"delay": "^4.4.0",
4040
"dirty-chai": "^2.0.1",
4141
"err-code": "^2.0.3",
42-
"ipfs-unixfs": "^2.0.3",
43-
"ipfs-unixfs-importer": "^5.0.0",
42+
"ipfs-unixfs": "https://gitpkg.now.sh/ipfs/js-ipfs-unixfs/packages/ipfs-unixfs?feat/add-types",
43+
"ipfs-unixfs-importer": "https://gitpkg.now.sh/ipfs/js-ipfs-unixfs/packages/ipfs-unixfs-importer?feat/add-types",
4444
"ipfs-utils": "^6.0.1",
4545
"ipld-block": "^0.11.0",
4646
"ipld-dag-cbor": "^0.17.0",
47-
"ipld-dag-pb": "^0.20.0",
47+
"ipld-dag-pb": "ipld/js-ipld-dag-pb#feat/add-types",
4848
"ipns": "^0.8.0",
4949
"is-ipfs": "^2.0.0",
5050
"iso-random-stream": "^1.1.1",

packages/ipfs-cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"ipfs-repo": "^8.0.0",
4444
"ipfs-utils": "^6.0.1",
4545
"ipld-dag-cbor": "^0.17.0",
46-
"ipld-dag-pb": "^0.20.0",
46+
"ipld-dag-pb": "ipld/js-ipld-dag-pb#feat/add-types",
4747
"it-all": "^1.0.4",
4848
"it-concat": "^1.0.1",
4949
"it-first": "^1.0.4",

packages/ipfs-core-types/tsconfig-check.aegir.tsbuildinfo

Lines changed: 1898 additions & 0 deletions
Large diffs are not rendered by default.

packages/ipfs-core/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,14 @@
7373
"ipfs-core-types": "^0.3.0",
7474
"ipfs-core-utils": "^0.7.1",
7575
"ipfs-repo": "^8.0.0",
76-
"ipfs-unixfs": "^2.0.3",
77-
"ipfs-unixfs-exporter": "^3.0.4",
78-
"ipfs-unixfs-importer": "^5.0.0",
76+
"ipfs-unixfs": "https://gitpkg.now.sh/ipfs/js-ipfs-unixfs/packages/ipfs-unixfs?feat/add-types",
77+
"ipfs-unixfs-exporter": "https://gitpkg.now.sh/ipfs/js-ipfs-unixfs/packages/ipfs-unixfs-exporter?feat/add-types",
78+
"ipfs-unixfs-importer": "https://gitpkg.now.sh/ipfs/js-ipfs-unixfs/packages/ipfs-unixfs-importer?feat/add-types",
7979
"ipfs-utils": "^6.0.1",
8080
"ipld": "^0.28.0",
8181
"ipld-block": "^0.11.0",
8282
"ipld-dag-cbor": "^0.17.0",
83-
"ipld-dag-pb": "^0.20.0",
83+
"ipld-dag-pb": "ipld/js-ipld-dag-pb#feat/add-types",
8484
"ipld-raw": "^6.0.0",
8585
"ipns": "^0.8.0",
8686
"is-domain-name": "^1.0.1",

packages/ipfs-core/src/components/files/utils/remove-link.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ const updateShard = async (context, positions, child, options) => {
127127

128128
log(`Updating shard ${prefix} with name ${newName}`)
129129

130-
const size = DAGNode.isDAGNode(result.node) ? result.node.size : result.node.Tsize
130+
const size = result.node instanceof DAGNode ? result.node.size : result.node.Tsize
131131

132132
return updateShardParent(context, bucket, node, prefix, newName, size, result.cid, options)
133133
}

packages/ipfs-core/src/components/object/links.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
'use strict'
22

3-
const dagPB = require('ipld-dag-pb')
4-
const DAGLink = dagPB.DAGLink
3+
const {
4+
DAGLink
5+
} = require('ipld-dag-pb')
56
const CID = require('cids')
67
const withTimeoutOption = require('ipfs-core-utils/src/with-timeout-option')
78

packages/ipfs-core/src/components/object/new.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
'use strict'
22

3-
const dagPB = require('ipld-dag-pb')
4-
const DAGNode = dagPB.DAGNode
3+
const {
4+
DAGNode
5+
} = require('ipld-dag-pb')
56
const multicodec = require('multicodec')
67
const Unixfs = require('ipfs-unixfs')
78
const withTimeoutOption = require('ipfs-core-utils/src/with-timeout-option')

packages/ipfs-core/src/components/object/put.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
'use strict'
22

3-
const dagPB = require('ipld-dag-pb')
4-
const DAGNode = dagPB.DAGNode
5-
const DAGLink = dagPB.DAGLink
3+
const {
4+
DAGNode,
5+
DAGLink,
6+
util: DAGLinkUtil
7+
} = require('ipld-dag-pb')
68
const mh = require('multihashing-async').multihash
79
const multicodec = require('multicodec')
810
const withTimeoutOption = require('ipfs-core-utils/src/with-timeout-option')
@@ -43,7 +45,7 @@ function parseJSONBuffer (buf) {
4345
}
4446

4547
function parseProtoBuffer (buf) {
46-
return dagPB.util.deserialize(buf)
48+
return DAGLinkUtil.deserialize(buf)
4749
}
4850

4951
/**
@@ -54,8 +56,7 @@ function parseProtoBuffer (buf) {
5456
*/
5557
module.exports = ({ ipld, gcLock, preload }) => {
5658
/**
57-
*
58-
* @param {Uint8Array|DAGNode|{ Data: any, links: DAGLink[]}} obj
59+
* @param {Uint8Array|DAGNode|{ Data: any, Links: DAGLink[]}} obj
5960
* @param {PutOptions & AbortOptions} options
6061
* @returns {Promise<CID>}
6162
*/
@@ -69,7 +70,7 @@ module.exports = ({ ipld, gcLock, preload }) => {
6970
} else {
7071
node = new DAGNode(obj)
7172
}
72-
} else if (DAGNode.isDAGNode(obj)) {
73+
} else if (obj instanceof DAGNode) {
7374
// already a dag node
7475
node = obj
7576
} else if (typeof obj === 'object') {

packages/ipfs-core/src/components/refs/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ async function * objectStream (ipld, rootCid, maxDepth, uniqueOnly) { // eslint-
155155
async function getLinks (ipld, cid) {
156156
const node = await ipld.get(new CID(cid))
157157

158-
if (DAGNode.isDAGNode(node)) {
158+
if (node instanceof DAGNode) {
159159
return node.Links.map(({ Name, Hash }) => ({ name: Name, cid: new CID(Hash) }))
160160
}
161161

0 commit comments

Comments
 (0)