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

Commit

Permalink
fix: regressions introduced by new releases of CID & multicodec (#3442)
Browse files Browse the repository at this point in the history
Few regressions had been introduced by

multiformats/js-cid@0e11f03#diff-25a6634263c1b1f6fc4697a04e2b9904ea4b042a89af59dc93ec1f5d44848a26

multiformats/js-multicodec@25cf33f

This changes fix two remaining problems:

1. Change type of codec from string to code name.
2. No longer import removed JSON file and use exported table instead.

Co-authored-by: achingbrain <alex@achingbrain.net>
  • Loading branch information
Gozala and achingbrain authored Dec 16, 2020
1 parent cacbfc6 commit b5152d8
Show file tree
Hide file tree
Showing 48 changed files with 70 additions and 62 deletions.
2 changes: 1 addition & 1 deletion examples/browser-add-readable-stream/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"keywords": [],
"license": "MIT",
"devDependencies": {
"ipfs": "^0.52.1",
"ipfs": "^0.52.2",
"test-ipfs-example": "^2.0.3"
}
}
2 changes: 1 addition & 1 deletion examples/browser-browserify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"concat-stream": "^2.0.0",
"execa": "^4.0.3",
"http-server": "^0.12.3",
"ipfs": "^0.52.1",
"ipfs": "^0.52.2",
"rimraf": "^3.0.2",
"test-ipfs-example": "^2.0.3"
},
Expand Down
2 changes: 1 addition & 1 deletion examples/browser-create-react-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"dependencies": {
"dot-prop": "^5.0.0",
"ipfs": "^0.52.1",
"ipfs": "^0.52.2",
"ipfs-css": "^0.13.1",
"react": "^16.8.6",
"react-dom": "^16.8.6",
Expand Down
4 changes: 2 additions & 2 deletions examples/browser-exchange-files/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
"browserify": "^16.2.3",
"execa": "^4.0.3",
"http-server": "^0.12.3",
"ipfs-http-client": "^48.1.1",
"ipfs-http-client": "^48.1.2",
"uint8arrays": "^1.1.0"
},
"dependencies": {
"ipfs": "^0.52.1",
"ipfs": "^0.52.2",
"it-all": "^1.0.4",
"rimraf": "^3.0.2",
"test-ipfs-example": "^2.0.3"
Expand Down
4 changes: 2 additions & 2 deletions examples/browser-http-client-upload-file/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
],
"license": "MIT",
"dependencies": {
"ipfs-http-client": "^48.1.1"
"ipfs-http-client": "^48.1.2"
},
"devDependencies": {
"ipfs": "^0.52.1",
"ipfs": "^0.52.2",
"parcel-bundler": "^1.12.4",
"react": "^16.8.6",
"react-dom": "^16.8.6",
Expand Down
4 changes: 2 additions & 2 deletions examples/browser-ipns-publish/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"license": "MIT",
"dependencies": {
"human-crypto-keys": "^0.1.4",
"ipfs": "^0.52.1",
"ipfs-http-client": "^48.1.1",
"ipfs": "^0.52.2",
"ipfs-http-client": "^48.1.2",
"ipfs-utils": "^5.0.0",
"ipns": "^0.8.0",
"it-last": "^1.0.4",
Expand Down
2 changes: 1 addition & 1 deletion examples/browser-mfs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"webpack-cli": "^3.3.11"
},
"dependencies": {
"ipfs": "^0.52.1",
"ipfs": "^0.52.2",
"mime-sniffer": "~0.0.3"
}
}
2 changes: 1 addition & 1 deletion examples/browser-parceljs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"ipfs": "^0.52.1"
"ipfs": "^0.52.2"
},
"devDependencies": {
"@babel/cli": "^7.1.5",
Expand Down
2 changes: 1 addition & 1 deletion examples/browser-readablestream/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"webpack": "^4.43.0"
},
"dependencies": {
"ipfs": "^0.52.1",
"ipfs": "^0.52.2",
"it-to-stream": "^0.1.2",
"videostream": "^3.2.0"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/browser-script-tag/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"test-ipfs-example": "^2.0.3"
},
"dependencies": {
"ipfs": "^0.52.1"
"ipfs": "^0.52.2"
}
}
2 changes: 1 addition & 1 deletion examples/browser-service-worker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"webpack-dev-server": "3.11.0"
},
"dependencies": {
"ipfs": "^0.51.0",
"ipfs": "^0.52.0",
"ipfs-message-port-client": "^0.3.0",
"ipfs-message-port-protocol": "^0.3.0",
"ipfs-message-port-server": "^0.3.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/browser-sharing-node-across-tabs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"worker-plugin": "4.0.3"
},
"dependencies": {
"ipfs": "^0.52.1",
"ipfs": "^0.52.2",
"ipfs-message-port-client": "^0.4.1",
"ipfs-message-port-server": "^0.4.1"
},
Expand Down
2 changes: 1 addition & 1 deletion examples/browser-video-streaming/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"test-ipfs-example": "^2.0.3"
},
"dependencies": {
"ipfs": "^0.52.1"
"ipfs": "^0.52.2"
}
}
2 changes: 1 addition & 1 deletion examples/browser-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"dependencies": {
"core-js": "^3.6.4",
"ipfs": "^0.52.1",
"ipfs": "^0.52.2",
"vue": "^2.6.11"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/browser-webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"webpack-dev-server": "^3.11.0"
},
"dependencies": {
"ipfs": "^0.52.1"
"ipfs": "^0.52.2"
},
"browserslist": [
">1%",
Expand Down
4 changes: 2 additions & 2 deletions examples/circuit-relaying/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
"license": "MIT",
"dependencies": {
"delay": "^4.4.0",
"ipfs": "^0.52.1",
"ipfs": "^0.52.2",
"ipfs-pubsub-room": "^2.0.1",
"uint8arrays": "^1.1.0"
},
"devDependencies": {
"execa": "^4.0.3",
"ipfs-css": "^0.13.1",
"ipfs-http-client": "^48.1.1",
"ipfs-http-client": "^48.1.2",
"parcel-bundler": "^1.12.4",
"rimraf": "^3.0.2",
"tachyons": "^4.11.1",
Expand Down
2 changes: 1 addition & 1 deletion examples/custom-ipfs-repo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"license": "MIT",
"dependencies": {
"datastore-fs": "^2.0.0",
"ipfs": "^0.52.1",
"ipfs": "^0.52.2",
"ipfs-repo": "^7.0.0",
"it-all": "^1.0.4"
},
Expand Down
10 changes: 7 additions & 3 deletions examples/custom-ipld-formats/daemon-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@
const codecName = 'dag-test'
const codecNumber = 392091

const baseTable = require('multicodec/src/base-table.json')
baseTable[codecName] = codecNumber
const table = require('multicodec/src/base-table')
// @ts-ignore
table.baseTable = {
...table.baseTable,
[codecName]: codecNumber
}

// now require modules as usual
const IPFSDaemon = require('ipfs-cli/src/daemon')
const IPFSDaemon = require('ipfs-daemon')
const multihashing = require('multihashing-async')
const multihash = multihashing.multihash
const multicodec = require('multicodec')
Expand Down
8 changes: 6 additions & 2 deletions examples/custom-ipld-formats/in-process-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
const codecName = 'dag-test'
const codecNumber = 392091

const baseTable = require('multicodec/src/base-table.json')
baseTable[codecName] = codecNumber
const table = require('multicodec/src/base-table')
// @ts-ignore
table.baseTable = {
...table.baseTable,
[codecName]: codecNumber
}

// now require modules as usual
const IPFS = require('ipfs-core')
Expand Down
8 changes: 4 additions & 4 deletions examples/custom-ipld-formats/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
"test-ipfs-example": "^2.0.3"
},
"dependencies": {
"cids": "1.0.2",
"ipfs-cli": "^0.1.0",
"ipfs-core": "^0.2.1",
"ipfs-http-client": "^48.1.1",
"cids": "^1.0.0",
"ipfs-daemon": "^0.3.1",
"ipfs-core": "^0.3.0",
"ipfs-http-client": "^48.1.2",
"multicodec": "^2.0.1",
"multihashing-async": "^2.0.1",
"uint8arrays": "^1.1.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/custom-libp2p/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"license": "MIT",
"dependencies": {
"ipfs": "^0.52.1",
"ipfs": "^0.52.2",
"libp2p": "^0.29.3",
"libp2p-bootstrap": "^0.12.1",
"libp2p-kad-dht": "^0.20.1",
Expand Down
4 changes: 2 additions & 2 deletions examples/explore-ethereum-blockchain/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"keywords": [],
"license": "MIT",
"devDependencies": {
"ipfs": "^0.52.1",
"ipfs-http-client": "^48.1.1",
"ipfs": "^0.52.2",
"ipfs-http-client": "^48.1.2",
"ipfsd-ctl": "^7.1.1",
"ipld-ethereum": "^5.0.1",
"test-ipfs-example": "^2.0.3"
Expand Down
4 changes: 2 additions & 2 deletions examples/http-client-browser-pubsub/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
"author": "Alan Shaw",
"license": "MIT",
"dependencies": {
"ipfs-http-client": "^48.1.1"
"ipfs-http-client": "^48.1.2"
},
"browserslist": [
"last 2 versions and not dead and > 2%"
],
"devDependencies": {
"execa": "^4.0.3",
"go-ipfs": "^0.7.0",
"ipfs": "^0.52.1",
"ipfs": "^0.52.2",
"ipfsd-ctl": "^7.1.1",
"parcel-bundler": "^1.12.4",
"test-ipfs-example": "^2.0.3"
Expand Down
4 changes: 2 additions & 2 deletions examples/http-client-bundle-webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"license": "MIT",
"keywords": [],
"dependencies": {
"ipfs-http-client": "^48.1.1",
"ipfs-http-client": "^48.1.2",
"react": "^16.8.6",
"react-dom": "^16.8.6"
},
Expand All @@ -24,7 +24,7 @@
"babel-loader": "^8.0.5",
"copy-webpack-plugin": "^5.0.4",
"execa": "^4.0.3",
"ipfs": "^0.52.1",
"ipfs": "^0.52.2",
"ipfsd-ctl": "^7.1.1",
"react-hot-loader": "^4.12.21",
"rimraf": "^3.0.2",
Expand Down
2 changes: 1 addition & 1 deletion examples/http-client-name-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"author": "Tara Vancil <tbvanc@gmail.com>",
"license": "MIT",
"dependencies": {
"ipfs-http-client": "^48.1.1"
"ipfs-http-client": "^48.1.2"
},
"devDependencies": {
"execa": "^4.0.3",
Expand Down
2 changes: 1 addition & 1 deletion examples/ipfs-101/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"author": "David Dias <daviddias@ipfs.io>",
"license": "MIT",
"dependencies": {
"ipfs": "^0.52.1",
"ipfs": "^0.52.2",
"it-all": "^1.0.4",
"uint8arrays": "^1.1.0"
},
Expand Down
2 changes: 1 addition & 1 deletion examples/run-in-electron/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"devDependencies": {
"electron": "^6.0.0",
"electron-rebuild": "^1.8.4",
"ipfs": "^0.52.1",
"ipfs": "^0.52.2",
"test-ipfs-example": "^2.0.3"
},
"greenkeeper": {
Expand Down
2 changes: 1 addition & 1 deletion examples/running-multiple-nodes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
"test-ipfs-example": "^2.0.3"
},
"dependencies": {
"ipfs": "^0.52.1"
"ipfs": "^0.52.2"
}
}
2 changes: 1 addition & 1 deletion examples/traverse-ipld-graphs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"dependencies": {
"cids": "^1.0.0",
"ipfs": "^0.52.1",
"ipfs": "^0.52.2",
"ipld-block": "^0.11.0",
"ipld-dag-pb": "^0.20.0",
"ipld-git": "^0.6.1",
Expand Down
2 changes: 1 addition & 1 deletion examples/types-use-ipfs-from-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "example-types-use-ipfs-from-ts",
"private": true,
"dependencies": {
"ipfs": "^0.52.1"
"ipfs": "^0.52.2"
},
"devDependencies": {
"typescript": "4.0.x"
Expand Down
1 change: 0 additions & 1 deletion examples/types-use-ipfs-from-ts/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export default async function main() {

console.log('Added file:', file.path, file.cid.toString())
try {
// @ts-expect-error CID has no toUpperCase method
file.cid.toUpperCase()
} catch (error) {

Expand Down
2 changes: 1 addition & 1 deletion examples/types-use-ipfs-from-typed-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "example-types-use-ipfs-from-typed-js",
"private": true,
"dependencies": {
"ipfs": "^0.52.1"
"ipfs": "^0.52.2"
},
"devDependencies": {
"typescript": "4.0.x"
Expand Down
1 change: 0 additions & 1 deletion examples/types-use-ipfs-from-typed-js/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ async function main () {

console.log('Added file:', file.path, file.cid.toString())
try {
// @ts-expect-error CID has no toUpperCase method
file.cid.toUpperCase()
} catch(error) {

Expand Down
2 changes: 1 addition & 1 deletion packages/interface-ipfs-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"chai": "^4.2.0",
"chai-as-promised": "^7.1.1",
"chai-subset": "^1.6.0",
"cids": "1.0.2",
"cids": "^1.0.0",
"delay": "^4.4.0",
"dirty-chai": "^2.0.1",
"err-code": "^2.0.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/ipfs-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"bignumber.js": "^9.0.0",
"byteman": "^1.3.5",
"cid-tool": "^1.0.0",
"cids": "1.0.2",
"cids": "^1.0.0",
"debug": "^4.1.1",
"err-code": "^2.0.3",
"execa": "^5.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/ipfs-cli/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ const escapeControlCharacters = (str) => {
* CID properties
*
* @param {object} obj - all keys/values in this object will be have control characters stripped
* @param {string} cidBase - any encountered CIDs will be stringified using this base
* @param {import('cids').BaseNameOrCode} cidBase - any encountered CIDs will be stringified using this base
* @returns {object}
*/
const makeEntriesPrintable = (obj, cidBase = 'base58btc') => {
Expand Down
2 changes: 1 addition & 1 deletion packages/ipfs-core-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"any-signal": "^2.0.0",
"blob-to-it": "^1.0.1",
"browser-readablestream-to-it": "^1.0.1",
"cids": "1.0.2",
"cids": "^1.0.0",
"err-code": "^2.0.3",
"ipfs-utils": "^5.0.0",
"it-all": "^1.0.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/ipfs-core-utils/src/cid.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const CID = require('cids')
*
* @param {CID|Uint8Array|string} input - The CID to encode
* @param {Object} [options] - Optional options
* @param {string} [options.base] - Name of multibase codec to encode the CID with
* @param {import('cids').BaseNameOrCode} [options.base] - Name of multibase codec to encode the CID with
* @param {boolean} [options.upgrade] - Automatically upgrade v0 CIDs to v1 when
* necessary. Default: true.
* @returns {string} - CID in string representation
Expand Down
Loading

0 comments on commit b5152d8

Please sign in to comment.