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

Commit

Permalink
chore: update deps & remove obsolete ignores
Browse files Browse the repository at this point in the history
  • Loading branch information
Gozala committed Oct 20, 2020
1 parent 88770f9 commit edb367a
Show file tree
Hide file tree
Showing 31 changed files with 42 additions and 47 deletions.
2 changes: 1 addition & 1 deletion examples/traverse-ipld-graphs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"test-ipfs-example": "^2.0.3"
},
"dependencies": {
"cids": "^1.0.0",
"cids": "^1.0.2",
"ipfs": "^0.50.1",
"ipld-block": "^0.10.1",
"ipld-dag-pb": "^0.20.0",
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.0",
"cids": "^1.0.2",
"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.0",
"cids": "^1.0.2",
"debug": "^4.1.1",
"dlv": "^1.1.3",
"electron-webrtc": "^0.3.0",
Expand Down
4 changes: 1 addition & 3 deletions packages/ipfs-cli/src/daemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,7 @@ function getLibp2p ({ libp2pOptions, options, config, peerId }) {
const delegateAddr = Multiaddr(delegateString).toOptions()
const delegateApiOptions = {
host: delegateAddr.host,
// port is a string atm, so we need to convert for the check
// @ts-ignore - parseInt(input:string) => number
protocol: parseInt(delegateAddr.port) === 443 ? 'https' : 'http',
protocol: parseInt(`${delegateAddr.port}`) === 443 ? 'https' : 'http',
port: delegateAddr.port
}

Expand Down
4 changes: 2 additions & 2 deletions packages/ipfs-core-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
"license": "MIT",
"dependencies": {
"blob-to-it": "0.0.2",
"browser-readablestream-to-it": "0.0.2",
"cids": "^1.0.0",
"browser-readablestream-to-it": "^1.0.1",
"cids": "^1.0.2",
"err-code": "^2.0.3",
"ipfs-utils": "^4.0.0",
"it-all": "^1.0.4",
Expand Down
1 change: 0 additions & 1 deletion packages/ipfs-core-utils/src/cid.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ exports.cidToString = (input, options = {}) => {
const upgrade = options.upgrade !== false
let cid = CID.isCID(input)
? input
// @ts-ignore - TS seems to get confused by the type defs in CID repo.
: new CID(input)

if (cid.version === 0 && options.base && options.base !== 'base58btc') {
Expand Down
2 changes: 1 addition & 1 deletion packages/ipfs-core-utils/src/pins/normalise-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ module.exports = async function * normaliseInput (input) {
// { cid: CID recursive, metadata }
// @ts-ignore - it still could be iterable or async iterable
if (input.cid != null || input.path != null) {
// @ts-ignore
// @ts-ignore - same as above
return yield toPin(input)
}

Expand Down
2 changes: 1 addition & 1 deletion packages/ipfs-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"array-shuffle": "^1.0.1",
"bignumber.js": "^9.0.0",
"cbor": "^5.1.0",
"cids": "^1.0.0",
"cids": "^1.0.2",
"class-is": "^1.1.0",
"dag-cbor-links": "^2.0.0",
"datastore-core": "^2.0.0",
Expand Down
2 changes: 0 additions & 2 deletions packages/ipfs-core/src/components/block/put.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ module.exports = ({ blockService, pin, gcLock, preload }) => {
// Pick appropriate CID version
cidVersion = mhtype === 'sha2-256' && format === 'dag-pb' ? 0 : 1
} else {
// @ts-ignore - options.version is a {number} but the CID constructor arg version is a {0|1}
// TODO: https://github.com/multiformats/js-cid/pull/129
cidVersion = options.version
}

Expand Down
1 change: 0 additions & 1 deletion packages/ipfs-core/src/components/block/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ exports.cleanCid = cid => {

// CID constructor knows how to do the cleaning :)
try {
// @ts-ignore - string|Uint8Array union seems to confuse CID typedefs.
return new CID(cid)
} catch (err) {
throw errCode(err, 'ERR_INVALID_CID')
Expand Down
3 changes: 1 addition & 2 deletions packages/ipfs-core/src/components/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,6 @@ function createPeerId ({ privateKey, algorithm = 'RSA', bits, print }) {
} else {
// Generate peer identity keypair + transform to desired format + add to config.
print('generating %s-bit (rsa only) %s keypair...', bits, algorithm)
// @ts-ignore - expects "Ed25519" | "RSA" | "secp256k1" instoad of string
return PeerId.create({ keyType: algorithm, bits })
}
}
Expand Down Expand Up @@ -551,7 +550,7 @@ function createApi ({
* @typedef {import('./config').IPFSConfig} IPFSConfig
* @typedef {import('.').IPFSRepo} IPFSRepo
*
* @typedef {'RSA' | 'ed25519' | 'secp256k1'} KeyType
* @typedef {import('libp2p-crypto').KeyType} KeyType
*
* @typedef {string|PeerId} PrivateKey
* Can be either a base64 string or a [PeerId](https://github.com/libp2p/js-peer-id)
Expand Down
9 changes: 3 additions & 6 deletions packages/ipfs-core/src/components/pin/ls.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module.exports = ({ pinManager, dag }) => {
/**
* List all the objects pinned to local storage
*
* @param {LsOptions} [options]
* @param {LsOptions & AbortOptions} [options]
* @returns {AsyncIterable<LsEntry>}
* @example
* ```js
Expand Down Expand Up @@ -106,8 +106,6 @@ module.exports = ({ pinManager, dag }) => {
}

if (type === PinTypes.indirect || type === PinTypes.all) {
// @ts-ignore - LsSettings & AbortOptions have no properties in common
// with type { preload?: boolean }
for await (const cid of pinManager.indirectKeys(options)) {
yield toPin(PinTypes.indirect, cid)
}
Expand All @@ -124,11 +122,10 @@ module.exports = ({ pinManager, dag }) => {
}

/**
* @typedef {LsSettings & AbortOptions} LsOptions
*
* @typedef {Object} LsSettings
* @typedef {Object} LsOptions
* @property {string[]|CID[]} [paths] - CIDs or IPFS paths to search for in the pinset.
* @property {PinQueryType} [type] - Filter by this type of pin ("recursive", "direct" or "indirect")
* @property {boolean} [preload]
*
* @typedef {Object} LsEntry
* @property {CID} cid - CID of the pinned node
Expand Down
2 changes: 1 addition & 1 deletion packages/ipfs-core/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ async function create (options = {}) {
* @typedef {NonNullable<typeof startedApi>} StartedAPI
* @type {If<Init, If<Start, StartedAPI, InitializedAPI>, API>}
*/
// @ts-ignore
// @ts-ignore - Will be fixed by https://github.com/ipfs/js-ipfs/issues/3285
const ipfs = startedApi || initializedApi || api
return ipfs
}
Expand Down
3 changes: 1 addition & 2 deletions packages/ipfs-core/src/ipns/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ class IPNS {

// // Add to cache
const id = peerId.toB58String()
// @ts-ignore - parseFloat expects string
const ttEol = parseFloat(lifetime)
const ttEol = parseFloat(`${lifetime}`)
const ttl = (ttEol < defaultRecordTtl) ? ttEol : defaultRecordTtl

this.cache.set(id, value, ttl)
Expand Down
1 change: 0 additions & 1 deletion packages/ipfs-core/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ const normalizeCidPath = (path) => {
*/
const resolvePath = async function (dag, ipfsPath, options = {}) {
if (isIpfs.cid(ipfsPath)) {
// @ts-ignore - CID|string seems to confuse typedef
return new CID(ipfsPath)
}

Expand Down
2 changes: 1 addition & 1 deletion packages/ipfs-core/src/utils/tlru.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

/** @type {typeof import('hashlru').default} */
// @ts-ignore - hashlru has incorrect typedefs
// @ts-ignore - https://github.com/dominictarr/hashlru/pull/24
const hashlru = require('hashlru')

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/ipfs-http-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"dependencies": {
"any-signal": "^2.0.0",
"bignumber.js": "^9.0.0",
"cids": "^1.0.0",
"cids": "^1.0.2",
"debug": "^4.1.1",
"form-data": "^3.0.0",
"ipfs-core-utils": "^0.4.0",
Expand Down
5 changes: 4 additions & 1 deletion packages/ipfs-http-client/src/bitswap/unwant.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@ module.exports = configure(api => {
* @type {import('..').Implements<import('ipfs-core/src/components/bitswap/unwant')>}
*/
async function unwant (cid, options = {}) {
if (Array.isArray(cid)) {
throw Error('cid argument must be CID or a string')
}

const res = await api.post('bitswap/unwant', {
timeout: options.timeout,
signal: options.signal,
searchParams: toUrlSearchParams({
// @ts-ignore - CID|string seems to confuse typedef
arg: typeof cid === 'string' ? cid : new CID(cid).toString(),
...options
}),
Expand Down
2 changes: 1 addition & 1 deletion packages/ipfs-http-client/src/bitswap/wantlist-for-peer.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = configure(api => {
* @type {import('..').Implements<typeof import('ipfs-core/src/components/bitswap/wantlist-for-peer')>}
*/
async function wantlistForPeer (peerId, options = {}) {
// @ts-ignore - CID|string seems to confuse typedef
// @ts-ignore - CID doesn't take PeerId instance
peerId = typeof peerId === 'string' ? peerId : new CID(peerId).toString()

const res = await (await api.post('bitswap/wantlist', {
Expand Down
1 change: 0 additions & 1 deletion packages/ipfs-http-client/src/block/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ module.exports = configure(api => {
* @type {import('..').Implements<import('ipfs-core/src/components/block/get')>}
*/
async function get (cid, options = {}) {
// @ts-ignore - CID|string seems to confuse typedef
cid = new CID(cid)

const res = await api.post('block/get', {
Expand Down
1 change: 0 additions & 1 deletion packages/ipfs-http-client/src/dag/put.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ module.exports = configure((api, opts) => {

if (!format) {
if (opts && opts.ipld && opts.ipld.loadFormat) {
// @ts-ignore - loadFormat expect string but it could be a number
format = await opts.ipld.loadFormat(settings.format)
}

Expand Down
8 changes: 7 additions & 1 deletion packages/ipfs-http-client/src/lib/buffer-to-form-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ const FormData = require('form-data')

// TODO form data append doesnt have header option

// @ts-ignore
/**
* @param {Uint8Array} buf
* @param {Object} [options]
* @param {number|string} [options.mode]
* @param {number|string} [options.mtime]
* @param {number|string} [options.mtimeNsecs]
*/
module.exports = (buf, { mode, mtime, mtimeNsecs } = {}) => {
const headers = {}

Expand Down
9 changes: 6 additions & 3 deletions packages/ipfs-http-client/src/lib/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ const parseTimeout = (value) => {
* @property {URL|string} [url] - Full API URL.
* @property {object} [ipld]
* @property {any[]} [ipld.formats] - An array of additional [IPLD formats](https://github.com/ipld/interface-ipld-format) to support
* @property {(format: string) => Promise<any>} [ipld.loadFormat] - an async function that takes the name of an [IPLD format](https://github.com/ipld/interface-ipld-format) as a string and should return the implementation of that codec
* @property {(format: string|number) => Promise<any>} [ipld.loadFormat] - an async function that takes the name of an [IPLD format](https://github.com/ipld/interface-ipld-format) as a string and should return the implementation of that codec
*/
class Client extends HTTP {
/**
Expand All @@ -127,10 +127,13 @@ class Client extends HTTP {
headers: opts.headers,
base: normalizeInput(opts.url).toString(),
handleError: errorHandler,
/**
* @param {URLSearchParams} search
* @returns {URLSearchParams}
*/
transformSearchParams: (search) => {
const out = new URLSearchParams()

// @ts-ignore https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams
for (const [key, value] of search) {
if (
value !== 'undefined' &&
Expand All @@ -141,7 +144,7 @@ class Client extends HTTP {
}

// server timeouts are strings
if (key === 'timeout' && !isNaN(value)) {
if (key === 'timeout' && !isNaN(parseInt(value))) {
out.append(kebabCase(key), value)
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/ipfs-http-gateway/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@hapi/ammo": "^5.0.1",
"@hapi/boom": "^9.1.0",
"@hapi/hapi": "^20.0.0",
"cids": "^1.0.0",
"cids": "^1.0.2",
"debug": "^4.1.1",
"hapi-pino": "^8.3.0",
"ipfs-core-utils": "^0.4.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/ipfs-http-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@hapi/boom": "^9.1.0",
"@hapi/content": "^5.0.2",
"@hapi/hapi": "^20.0.0",
"cids": "^1.0.0",
"cids": "^1.0.2",
"debug": "^4.1.1",
"dlv": "^1.1.3",
"err-code": "^2.0.3",
Expand Down
3 changes: 1 addition & 2 deletions packages/ipfs-http-server/src/api/resources/shutdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
*/
module.exports = {
handler: (_request, h) => {
// @ts-ignore - TS expects second argument
setImmediate(() => process.emit('SIGTERM'))
setImmediate(() => process.emit('SIGTERM', 'SIGTERM'))
return h.response()
}
}
2 changes: 1 addition & 1 deletion packages/ipfs-http-server/src/utils/joi.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const reqiureIfRequired = (value, helpers) => {
module.exports = Joi
.extend(
// @ts-ignore - according to typedfs coerce should always return
// { errors?: ErrorReport[], value?: any }
// { errors?: ErrorReport[], value?: any } but below undefined is returned.
(joi) => {
return {
type: 'cid',
Expand Down
4 changes: 2 additions & 2 deletions packages/ipfs-message-port-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
"dep-check": "aegir dep-check"
},
"dependencies": {
"browser-readablestream-to-it": "0.0.2",
"cids": "^1.0.0"
"browser-readablestream-to-it": "^1.0.1",
"cids": "^1.0.2"
},
"devDependencies": {
"aegir": "^28.0.0",
Expand Down
2 changes: 0 additions & 2 deletions packages/ipfs-message-port-client/src/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ const {
encodeIterable,
encodeCallback
} = require('ipfs-message-port-protocol/src/core')
/** @type {<T>(stream:ReadableStream<T>) => AsyncIterable<T>} */
// @ts-ignore - browser-stream-to-it has not types
const iterateReadableStream = require('browser-readablestream-to-it')

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/ipfs-message-port-protocol/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"dep-check": "aegir dep-check"
},
"dependencies": {
"cids": "^1.0.0",
"cids": "^1.0.2",
"ipld-block": "^0.10.1"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/ipfs-message-port-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"dep-check": "aegir dep-check"
},
"dependencies": {
"cids": "^1.0.0",
"cids": "^1.0.2",
"it-all": "^1.0.4"
},
"devDependencies": {
Expand Down

0 comments on commit edb367a

Please sign in to comment.