From 0c269cf67a8f6b48809472e83c4c1cff156afe0b Mon Sep 17 00:00:00 2001 From: Alex Potsides Date: Fri, 3 Dec 2021 13:20:36 +0000 Subject: [PATCH] chore: add default option extentions (#3965) We can extend options passed to the core-api by defining an extension object, this is so we can pass http options to the http api client but still get type safety. We define a default extension type of `{}` so we don't need to define the extension in places we aren't extending it (e.g. ipfs-core). Problem is, JSDoc doesn't pick up the default extension object so we need to add it to the function definitions. Refs: https://github.com/ipfs/js-ipfs/pull/3917#discussion_r761886258 --- packages/ipfs-cli/src/commands/get.js | 4 ++-- packages/ipfs-core-config/src/init-assets.js | 2 +- packages/ipfs-core-types/src/root.ts | 2 +- packages/ipfs-core/src/components/add-all/index.js | 2 +- packages/ipfs-core/src/components/add.js | 4 ++-- packages/ipfs-core/src/components/bitswap/stat.js | 2 +- .../ipfs-core/src/components/bitswap/unwant.js | 2 +- .../src/components/bitswap/wantlist-for-peer.js | 2 +- .../ipfs-core/src/components/bitswap/wantlist.js | 2 +- packages/ipfs-core/src/components/block/get.js | 2 +- packages/ipfs-core/src/components/block/put.js | 2 +- packages/ipfs-core/src/components/block/rm.js | 2 +- packages/ipfs-core/src/components/block/stat.js | 2 +- packages/ipfs-core/src/components/bootstrap/add.js | 2 +- .../ipfs-core/src/components/bootstrap/clear.js | 2 +- .../ipfs-core/src/components/bootstrap/list.js | 2 +- .../ipfs-core/src/components/bootstrap/reset.js | 2 +- packages/ipfs-core/src/components/bootstrap/rm.js | 2 +- packages/ipfs-core/src/components/cat.js | 2 +- packages/ipfs-core/src/components/config/index.js | 12 ++++++------ packages/ipfs-core/src/components/dag/export.js | 2 +- packages/ipfs-core/src/components/dag/get.js | 2 +- packages/ipfs-core/src/components/dag/import.js | 2 +- packages/ipfs-core/src/components/dag/put.js | 2 +- packages/ipfs-core/src/components/dag/resolve.js | 2 +- packages/ipfs-core/src/components/dht.js | 14 +++++++------- packages/ipfs-core/src/components/dns.js | 2 +- packages/ipfs-core/src/components/files/chmod.js | 2 +- packages/ipfs-core/src/components/files/cp.js | 2 +- packages/ipfs-core/src/components/files/flush.js | 2 +- packages/ipfs-core/src/components/files/ls.js | 2 +- packages/ipfs-core/src/components/files/mkdir.js | 2 +- packages/ipfs-core/src/components/files/mv.js | 2 +- packages/ipfs-core/src/components/files/read.js | 2 +- packages/ipfs-core/src/components/files/rm.js | 2 +- packages/ipfs-core/src/components/files/stat.js | 2 +- packages/ipfs-core/src/components/files/touch.js | 2 +- packages/ipfs-core/src/components/files/write.js | 2 +- packages/ipfs-core/src/components/get.js | 6 +++--- packages/ipfs-core/src/components/id.js | 2 +- packages/ipfs-core/src/components/key/export.js | 2 +- packages/ipfs-core/src/components/key/gen.js | 2 +- packages/ipfs-core/src/components/key/import.js | 2 +- packages/ipfs-core/src/components/key/info.js | 2 +- packages/ipfs-core/src/components/key/list.js | 2 +- packages/ipfs-core/src/components/key/rename.js | 2 +- packages/ipfs-core/src/components/key/rm.js | 2 +- packages/ipfs-core/src/components/ls.js | 2 +- packages/ipfs-core/src/components/name/index.js | 4 ++-- packages/ipfs-core/src/components/name/publish.js | 4 ++-- .../ipfs-core/src/components/name/pubsub/cancel.js | 2 +- .../ipfs-core/src/components/name/pubsub/state.js | 2 +- .../ipfs-core/src/components/name/pubsub/subs.js | 2 +- packages/ipfs-core/src/components/name/resolve.js | 6 +++--- packages/ipfs-core/src/components/object/data.js | 2 +- packages/ipfs-core/src/components/object/get.js | 2 +- packages/ipfs-core/src/components/object/links.js | 2 +- packages/ipfs-core/src/components/object/new.js | 2 +- .../src/components/object/patch/add-link.js | 2 +- .../src/components/object/patch/append-data.js | 2 +- .../src/components/object/patch/rm-link.js | 2 +- .../src/components/object/patch/set-data.js | 2 +- packages/ipfs-core/src/components/object/put.js | 2 +- packages/ipfs-core/src/components/object/stat.js | 2 +- packages/ipfs-core/src/components/pin/add-all.js | 2 +- packages/ipfs-core/src/components/pin/add.js | 2 +- packages/ipfs-core/src/components/pin/ls.js | 2 +- packages/ipfs-core/src/components/pin/rm-all.js | 2 +- packages/ipfs-core/src/components/pin/rm.js | 4 ++-- packages/ipfs-core/src/components/ping.js | 2 +- packages/ipfs-core/src/components/pubsub.js | 10 +++++----- packages/ipfs-core/src/components/refs/index.js | 13 +++++++++---- packages/ipfs-core/src/components/refs/local.js | 2 +- packages/ipfs-core/src/components/repo/gc.js | 2 +- packages/ipfs-core/src/components/repo/stat.js | 2 +- packages/ipfs-core/src/components/repo/version.js | 2 +- packages/ipfs-core/src/components/resolve.js | 2 +- packages/ipfs-core/src/components/start.js | 2 +- packages/ipfs-core/src/components/stats/bw.js | 8 ++++---- packages/ipfs-core/src/components/stop.js | 2 +- packages/ipfs-core/src/components/swarm/addrs.js | 2 +- packages/ipfs-core/src/components/swarm/connect.js | 2 +- .../ipfs-core/src/components/swarm/disconnect.js | 2 +- .../ipfs-core/src/components/swarm/local-addrs.js | 2 +- packages/ipfs-core/src/components/swarm/peers.js | 2 +- packages/ipfs-core/src/components/version.js | 2 +- packages/ipfs-core/src/version.js | 4 ++-- packages/ipfs-grpc-client/src/core-api/add-all.js | 2 +- packages/ipfs-grpc-client/src/core-api/files/ls.js | 2 +- .../ipfs-grpc-client/src/core-api/files/write.js | 2 +- packages/ipfs-grpc-client/src/core-api/id.js | 2 +- .../src/core-api/pubsub/subscribe.js | 2 +- .../src/core-api/pubsub/unsubscribe.js | 2 +- packages/ipfs-http-server/src/version.js | 2 +- packages/ipfs/src/package.js | 2 +- 95 files changed, 131 insertions(+), 126 deletions(-) diff --git a/packages/ipfs-cli/src/commands/get.js b/packages/ipfs-cli/src/commands/get.js index 375d5c7de9..ed5ec9c09a 100644 --- a/packages/ipfs-cli/src/commands/get.js +++ b/packages/ipfs-cli/src/commands/get.js @@ -43,7 +43,7 @@ export default { compressionLevel: { alias: ['l', 'compression-level'], type: 'number', - desc: 'The level of compression (1-9)', + desc: 'The level of compression (-1-9)', default: 6 } }, @@ -57,7 +57,7 @@ export default { * @param {number} argv.timeout * @param {boolean} argv.archive * @param {boolean} argv.compress - * @param {number} argv.compressionLevel + * @param {-1 | 0 | 1 | 2 | 3 | 4 | 5 | 6| 7 | 8| 9} argv.compressionLevel */ async handler ({ ctx: { ipfs, print }, ipfsPath, output, force, timeout, archive, compress, compressionLevel }) { print(`Saving file(s) ${stripControlCharacters(ipfsPath)}`) diff --git a/packages/ipfs-core-config/src/init-assets.js b/packages/ipfs-core-config/src/init-assets.js index 40efab5834..2fd51ee19c 100644 --- a/packages/ipfs-core-config/src/init-assets.js +++ b/packages/ipfs-core-config/src/init-assets.js @@ -5,7 +5,7 @@ import assets from './init-files/init-docs/index.js' * Add the default assets to the repo. * * @param {object} arg - * @param {import('ipfs-core-types/src/root').API["addAll"]} arg.addAll + * @param {import('ipfs-core-types/src/root').API<{}>["addAll"]} arg.addAll * @param {(msg: string) => void} arg.print */ export async function initAssets ({ addAll, print }) { diff --git a/packages/ipfs-core-types/src/root.ts b/packages/ipfs-core-types/src/root.ts index fcff5646f6..e885c7d015 100644 --- a/packages/ipfs-core-types/src/root.ts +++ b/packages/ipfs-core-types/src/root.ts @@ -259,7 +259,7 @@ export interface CatOptions extends AbortOptions, PreloadOptions { export interface GetOptions extends AbortOptions, PreloadOptions { archive?: boolean compress?: boolean - compressionLevel?: number + compressionLevel?: -1 | 0 | 1 | 2 | 3 | 4 | 5 | 6| 7 | 8| 9 } export interface ListOptions extends AbortOptions, PreloadOptions { diff --git a/packages/ipfs-core/src/components/add-all/index.js b/packages/ipfs-core/src/components/add-all/index.js index c6635dc704..3b0e8ce78e 100644 --- a/packages/ipfs-core/src/components/add-all/index.js +++ b/packages/ipfs-core/src/components/add-all/index.js @@ -22,7 +22,7 @@ export function createAddAll ({ repo, preload, options }) { const isShardingEnabled = options && options.sharding /** - * @type {import('ipfs-core-types/src/root').API["addAll"]} + * @type {import('ipfs-core-types/src/root').API<{}>["addAll"]} */ async function * addAll (source, options = {}) { const opts = mergeOptions({ diff --git a/packages/ipfs-core/src/components/add.js b/packages/ipfs-core/src/components/add.js index b0cd6e9cb8..836d5ab31d 100644 --- a/packages/ipfs-core/src/components/add.js +++ b/packages/ipfs-core/src/components/add.js @@ -3,11 +3,11 @@ import { normaliseInput } from 'ipfs-core-utils/files/normalise-input-single' /** * @param {Object} context - * @param {import('ipfs-core-types/src/root').API["addAll"]} context.addAll + * @param {import('ipfs-core-types/src/root').API<{}>["addAll"]} context.addAll */ export function createAdd ({ addAll }) { /** - * @type {import('ipfs-core-types/src/root').API["add"]} + * @type {import('ipfs-core-types/src/root').API<{}>["add"]} */ async function add (entry, options = {}) { // @ts-ignore TODO: https://github.com/ipfs/js-ipfs/issues/3290 diff --git a/packages/ipfs-core/src/components/bitswap/stat.js b/packages/ipfs-core/src/components/bitswap/stat.js index 097cb74293..4f9ecc1e46 100644 --- a/packages/ipfs-core/src/components/bitswap/stat.js +++ b/packages/ipfs-core/src/components/bitswap/stat.js @@ -6,7 +6,7 @@ import { withTimeoutOption } from 'ipfs-core-utils/with-timeout-option' */ export function createStat ({ network }) { /** - * @type {import('ipfs-core-types/src/bitswap').API["stat"]} + * @type {import('ipfs-core-types/src/bitswap').API<{}>["stat"]} */ async function stat (options = {}) { /** @type {import('ipfs-bitswap').IPFSBitswap} */ diff --git a/packages/ipfs-core/src/components/bitswap/unwant.js b/packages/ipfs-core/src/components/bitswap/unwant.js index 2243f2b8cc..3792e1c014 100644 --- a/packages/ipfs-core/src/components/bitswap/unwant.js +++ b/packages/ipfs-core/src/components/bitswap/unwant.js @@ -6,7 +6,7 @@ import { withTimeoutOption } from 'ipfs-core-utils/with-timeout-option' */ export function createUnwant ({ network }) { /** - * @type {import('ipfs-core-types/src/bitswap').API["unwant"]} + * @type {import('ipfs-core-types/src/bitswap').API<{}>["unwant"]} */ async function unwant (cids, options = {}) { const { bitswap } = await network.use(options) diff --git a/packages/ipfs-core/src/components/bitswap/wantlist-for-peer.js b/packages/ipfs-core/src/components/bitswap/wantlist-for-peer.js index 22a56f9d41..a685d7d123 100644 --- a/packages/ipfs-core/src/components/bitswap/wantlist-for-peer.js +++ b/packages/ipfs-core/src/components/bitswap/wantlist-for-peer.js @@ -7,7 +7,7 @@ import { withTimeoutOption } from 'ipfs-core-utils/with-timeout-option' */ export function createWantlistForPeer ({ network }) { /** - * @type {import('ipfs-core-types/src/bitswap').API["wantlistForPeer"]} + * @type {import('ipfs-core-types/src/bitswap').API<{}>["wantlistForPeer"]} */ async function wantlistForPeer (peerId, options = {}) { const { bitswap } = await network.use(options) diff --git a/packages/ipfs-core/src/components/bitswap/wantlist.js b/packages/ipfs-core/src/components/bitswap/wantlist.js index d926ec6e4f..797d6c2d8a 100644 --- a/packages/ipfs-core/src/components/bitswap/wantlist.js +++ b/packages/ipfs-core/src/components/bitswap/wantlist.js @@ -6,7 +6,7 @@ import { withTimeoutOption } from 'ipfs-core-utils/with-timeout-option' */ export function createWantlist ({ network }) { /** - * @type {import('ipfs-core-types/src/bitswap').API["wantlist"]} + * @type {import('ipfs-core-types/src/bitswap').API<{}>["wantlist"]} */ async function wantlist (options = {}) { const { bitswap } = await network.use(options) diff --git a/packages/ipfs-core/src/components/block/get.js b/packages/ipfs-core/src/components/block/get.js index cc7f26f446..f6aec6a17f 100644 --- a/packages/ipfs-core/src/components/block/get.js +++ b/packages/ipfs-core/src/components/block/get.js @@ -7,7 +7,7 @@ import { withTimeoutOption } from 'ipfs-core-utils/with-timeout-option' */ export function createGet ({ preload, repo }) { /** - * @type {import('ipfs-core-types/src/block').API["get"]} + * @type {import('ipfs-core-types/src/block').API<{}>["get"]} */ async function get (cid, options = {}) { // eslint-disable-line require-await if (options.preload !== false) { diff --git a/packages/ipfs-core/src/components/block/put.js b/packages/ipfs-core/src/components/block/put.js index 1d628dad8d..2a294a4cbc 100644 --- a/packages/ipfs-core/src/components/block/put.js +++ b/packages/ipfs-core/src/components/block/put.js @@ -15,7 +15,7 @@ import { withTimeoutOption } from 'ipfs-core-utils/with-timeout-option' */ export function createPut ({ codecs, hashers, repo, preload }) { /** - * @type {import('ipfs-core-types/src/block').API["put"]} + * @type {import('ipfs-core-types/src/block').API<{}>["put"]} */ async function put (block, options = {}) { const release = options.pin ? await repo.gcLock.readLock() : null diff --git a/packages/ipfs-core/src/components/block/rm.js b/packages/ipfs-core/src/components/block/rm.js index 55ef03d66f..e8fe0498f0 100644 --- a/packages/ipfs-core/src/components/block/rm.js +++ b/packages/ipfs-core/src/components/block/rm.js @@ -14,7 +14,7 @@ const BLOCK_RM_CONCURRENCY = 8 */ export function createRm ({ repo }) { /** - * @type {import('ipfs-core-types/src/block').API["rm"]} + * @type {import('ipfs-core-types/src/block').API<{}>["rm"]} */ async function * rm (cids, options = {}) { if (!Array.isArray(cids)) { diff --git a/packages/ipfs-core/src/components/block/stat.js b/packages/ipfs-core/src/components/block/stat.js index 206e09777f..52fb6b6a30 100644 --- a/packages/ipfs-core/src/components/block/stat.js +++ b/packages/ipfs-core/src/components/block/stat.js @@ -9,7 +9,7 @@ import { withTimeoutOption } from 'ipfs-core-utils/with-timeout-option' export function createStat ({ repo, preload }) { /** - * @type {import('ipfs-core-types/src/block').API["stat"]} + * @type {import('ipfs-core-types/src/block').API<{}>["stat"]} */ async function stat (cid, options = {}) { cid = cleanCid(cid) diff --git a/packages/ipfs-core/src/components/bootstrap/add.js b/packages/ipfs-core/src/components/bootstrap/add.js index ec5680b725..24ad645ddd 100644 --- a/packages/ipfs-core/src/components/bootstrap/add.js +++ b/packages/ipfs-core/src/components/bootstrap/add.js @@ -7,7 +7,7 @@ import { withTimeoutOption } from 'ipfs-core-utils/with-timeout-option' */ export function createAdd ({ repo }) { /** - * @type {import('ipfs-core-types/src/bootstrap').API["add"]} + * @type {import('ipfs-core-types/src/bootstrap').API<{}>["add"]} */ async function add (multiaddr, options = {}) { if (!isValidMultiaddr(multiaddr)) { diff --git a/packages/ipfs-core/src/components/bootstrap/clear.js b/packages/ipfs-core/src/components/bootstrap/clear.js index 3ace296865..b5c65f0316 100644 --- a/packages/ipfs-core/src/components/bootstrap/clear.js +++ b/packages/ipfs-core/src/components/bootstrap/clear.js @@ -7,7 +7,7 @@ import { Multiaddr } from 'multiaddr' */ export function createClear ({ repo }) { /** - * @type {import('ipfs-core-types/src/bootstrap').API["clear"]} + * @type {import('ipfs-core-types/src/bootstrap').API<{}>["clear"]} */ async function clear (options = {}) { /** @type {import('ipfs-core-types/src/config').Config} */ diff --git a/packages/ipfs-core/src/components/bootstrap/list.js b/packages/ipfs-core/src/components/bootstrap/list.js index 909b80f968..777ce07e11 100644 --- a/packages/ipfs-core/src/components/bootstrap/list.js +++ b/packages/ipfs-core/src/components/bootstrap/list.js @@ -7,7 +7,7 @@ import { Multiaddr } from 'multiaddr' */ export function createList ({ repo }) { /** - * @type {import('ipfs-core-types/src/bootstrap').API["list"]} + * @type {import('ipfs-core-types/src/bootstrap').API<{}>["list"]} */ async function list (options = {}) { /** @type {string[]|null} */ diff --git a/packages/ipfs-core/src/components/bootstrap/reset.js b/packages/ipfs-core/src/components/bootstrap/reset.js index bf34a6ecab..375837acae 100644 --- a/packages/ipfs-core/src/components/bootstrap/reset.js +++ b/packages/ipfs-core/src/components/bootstrap/reset.js @@ -8,7 +8,7 @@ import { Multiaddr } from 'multiaddr' */ export function createReset ({ repo }) { /** - * @type {import('ipfs-core-types/src/bootstrap').API["reset"]} + * @type {import('ipfs-core-types/src/bootstrap').API<{}>["reset"]} */ async function reset (options = {}) { /** @type {import('ipfs-core-types/src/config').Config} */ diff --git a/packages/ipfs-core/src/components/bootstrap/rm.js b/packages/ipfs-core/src/components/bootstrap/rm.js index 33564d9ce3..b2123e327c 100644 --- a/packages/ipfs-core/src/components/bootstrap/rm.js +++ b/packages/ipfs-core/src/components/bootstrap/rm.js @@ -7,7 +7,7 @@ import { withTimeoutOption } from 'ipfs-core-utils/with-timeout-option' */ export function createRm ({ repo }) { /** - * @type {import('ipfs-core-types/src/bootstrap').API["rm"]} + * @type {import('ipfs-core-types/src/bootstrap').API<{}>["rm"]} */ async function rm (multiaddr, options = {}) { if (!isValidMultiaddr(multiaddr)) { diff --git a/packages/ipfs-core/src/components/cat.js b/packages/ipfs-core/src/components/cat.js index d0110f0b18..f837fc59f4 100644 --- a/packages/ipfs-core/src/components/cat.js +++ b/packages/ipfs-core/src/components/cat.js @@ -12,7 +12,7 @@ import { CID } from 'multiformats/cid' */ export function createCat ({ repo, preload }) { /** - * @type {import('ipfs-core-types/src/root').API["cat"]} + * @type {import('ipfs-core-types/src/root').API<{}>["cat"]} */ async function * cat (ipfsPath, options = {}) { ipfsPath = normalizeCidPath(ipfsPath) diff --git a/packages/ipfs-core/src/components/config/index.js b/packages/ipfs-core/src/components/config/index.js index ea28e2f60e..21f5a83e8d 100644 --- a/packages/ipfs-core/src/components/config/index.js +++ b/packages/ipfs-core/src/components/config/index.js @@ -21,7 +21,7 @@ export function createConfig ({ repo }) { } /** - * @type {import('ipfs-core-types/src/config').API["getAll"]} + * @type {import('ipfs-core-types/src/config').API<{}>["getAll"]} */ async function getAll (options = {}) { // eslint-disable-line require-await // @ts-ignore TODO: move config typedefs into ipfs-repo @@ -29,7 +29,7 @@ export function createConfig ({ repo }) { } /** - * @type {import('ipfs-core-types/src/config').API["get"]} + * @type {import('ipfs-core-types/src/config').API<{}>["get"]} */ async function get (key, options) { // eslint-disable-line require-await if (!key) { @@ -41,21 +41,21 @@ export function createConfig ({ repo }) { } /** - * @type {import('ipfs-core-types/src/config').API["set"]} + * @type {import('ipfs-core-types/src/config').API<{}>["set"]} */ async function set (key, value, options) { // eslint-disable-line require-await return repo.config.set(key, value, options) } /** - * @type {import('ipfs-core-types/src/config').API["replace"]} + * @type {import('ipfs-core-types/src/config').API<{}>["replace"]} */ async function replace (value, options) { // eslint-disable-line require-await return repo.config.replace(value, options) } /** - * @type {import('ipfs-core-types/src/config/profiles').API["apply"]} + * @type {import('ipfs-core-types/src/config/profiles').API<{}>["apply"]} */ async function applyProfile (profileName, options = { dryRun: false }) { const { dryRun } = options @@ -91,7 +91,7 @@ export function createConfig ({ repo }) { } /** - * @type {import('ipfs-core-types/src/config/profiles').API["list"]} + * @type {import('ipfs-core-types/src/config/profiles').API<{}>["list"]} */ async function listProfiles (_options) { // eslint-disable-line require-await return Object.keys(profiles).map(name => ({ diff --git a/packages/ipfs-core/src/components/dag/export.js b/packages/ipfs-core/src/components/dag/export.js index f601dbbade..fb737f945d 100644 --- a/packages/ipfs-core/src/components/dag/export.js +++ b/packages/ipfs-core/src/components/dag/export.js @@ -31,7 +31,7 @@ const NO_LINKS_CODECS = [ */ export function createExport ({ repo, preload, codecs }) { /** - * @type {import('ipfs-core-types/src/dag').API["export"]} + * @type {import('ipfs-core-types/src/dag').API<{}>["export"]} */ async function * dagExport (root, options = {}) { if (options.preload !== false) { diff --git a/packages/ipfs-core/src/components/dag/get.js b/packages/ipfs-core/src/components/dag/get.js index c64932be48..75cee34a5d 100644 --- a/packages/ipfs-core/src/components/dag/get.js +++ b/packages/ipfs-core/src/components/dag/get.js @@ -12,7 +12,7 @@ import errCode from 'err-code' */ export function createGet ({ codecs, repo, preload }) { /** - * @type {import('ipfs-core-types/src/dag').API["get"]} + * @type {import('ipfs-core-types/src/dag').API<{}>["get"]} */ const get = async function get (cid, options = {}) { if (options.preload !== false) { diff --git a/packages/ipfs-core/src/components/dag/import.js b/packages/ipfs-core/src/components/dag/import.js index 38386e5349..6b4b852833 100644 --- a/packages/ipfs-core/src/components/dag/import.js +++ b/packages/ipfs-core/src/components/dag/import.js @@ -19,7 +19,7 @@ const log = debug('ipfs:components:dag:import') */ export function createImport ({ repo }) { /** - * @type {import('ipfs-core-types/src/dag').API["import"]} + * @type {import('ipfs-core-types/src/dag').API<{}>["import"]} */ async function * dagImport (sources, options = {}) { const release = await repo.gcLock.readLock() diff --git a/packages/ipfs-core/src/components/dag/put.js b/packages/ipfs-core/src/components/dag/put.js index d417dbb9c8..eeeea52e36 100644 --- a/packages/ipfs-core/src/components/dag/put.js +++ b/packages/ipfs-core/src/components/dag/put.js @@ -10,7 +10,7 @@ import { withTimeoutOption } from 'ipfs-core-utils/with-timeout-option' */ export function createPut ({ repo, codecs, hashers, preload }) { /** - * @type {import('ipfs-core-types/src/dag').API["put"]} + * @type {import('ipfs-core-types/src/dag').API<{}>["put"]} */ async function put (dagNode, options = {}) { const release = options.pin ? await repo.gcLock.readLock() : null diff --git a/packages/ipfs-core/src/components/dag/resolve.js b/packages/ipfs-core/src/components/dag/resolve.js index e30e34d0f0..0feb0bf244 100644 --- a/packages/ipfs-core/src/components/dag/resolve.js +++ b/packages/ipfs-core/src/components/dag/resolve.js @@ -10,7 +10,7 @@ import { resolvePath } from '../../utils.js' */ export function createResolve ({ repo, codecs, preload }) { /** - * @type {import('ipfs-core-types/src/dag').API["resolve"]} + * @type {import('ipfs-core-types/src/dag').API<{}>["resolve"]} */ async function dagResolve (ipfsPath, options = {}) { const { diff --git a/packages/ipfs-core/src/components/dht.js b/packages/ipfs-core/src/components/dht.js index b0b27ab78d..e94f21f010 100644 --- a/packages/ipfs-core/src/components/dht.js +++ b/packages/ipfs-core/src/components/dht.js @@ -157,7 +157,7 @@ function mapEvent (event) { export function createDht ({ network, repo, peerId }) { const { get, put, findProvs, findPeer, provide, query } = { /** - * @type {import('ipfs-core-types/src/dht').API["get"]} + * @type {import('ipfs-core-types/src/dht').API<{}>["get"]} */ async * get (key, options = {}) { const { libp2p } = await use(network, peerId, options) @@ -168,7 +168,7 @@ export function createDht ({ network, repo, peerId }) { }, /** - * @type {import('ipfs-core-types/src/dht').API["put"]} + * @type {import('ipfs-core-types/src/dht').API<{}>["put"]} */ async * put (key, value, options) { const { libp2p } = await use(network, peerId, options) @@ -179,9 +179,9 @@ export function createDht ({ network, repo, peerId }) { }, /** - * @type {import('ipfs-core-types/src/dht').API["findProvs"]} + * @type {import('ipfs-core-types/src/dht').API<{}>["findProvs"]} */ - async * findProvs (cid, options = { numProviders: 20 }) { + async * findProvs (cid, options = {}) { const { libp2p } = await use(network, peerId, options) yield * map(libp2p._dht.findProviders(cid, { @@ -190,7 +190,7 @@ export function createDht ({ network, repo, peerId }) { }, /** - * @type {import('ipfs-core-types/src/dht').API["findPeer"]} + * @type {import('ipfs-core-types/src/dht').API<{}>["findPeer"]} */ async * findPeer (peerIdToFind, options = {}) { const { libp2p } = await use(network, peerId, options) @@ -201,7 +201,7 @@ export function createDht ({ network, repo, peerId }) { }, /** - * @type {import('ipfs-core-types/src/dht').API["provide"]} + * @type {import('ipfs-core-types/src/dht').API<{}>["provide"]} */ async * provide (cid, options = { recursive: false }) { const { libp2p } = await use(network, peerId, options) @@ -222,7 +222,7 @@ export function createDht ({ network, repo, peerId }) { }, /** - * @type {import('ipfs-core-types/src/dht').API["query"]} + * @type {import('ipfs-core-types/src/dht').API<{}>["query"]} */ async * query (peerIdToQuery, options = {}) { const { libp2p } = await use(network, peerId, options) diff --git a/packages/ipfs-core/src/components/dns.js b/packages/ipfs-core/src/components/dns.js index f3ea31e358..7bc46acac6 100644 --- a/packages/ipfs-core/src/components/dns.js +++ b/packages/ipfs-core/src/components/dns.js @@ -17,7 +17,7 @@ function fqdnFixups (domain) { export function createDns () { /** - * @type {import('ipfs-core-types/src/root').API["dns"]} + * @type {import('ipfs-core-types/src/root').API<{}>["dns"]} */ const resolveDNS = async (domain, options = { recursive: true }) => { // eslint-disable-line require-await if (typeof domain !== 'string') { diff --git a/packages/ipfs-core/src/components/files/chmod.js b/packages/ipfs-core/src/components/files/chmod.js index ea932ee94e..0fabaca6fe 100644 --- a/packages/ipfs-core/src/components/files/chmod.js +++ b/packages/ipfs-core/src/components/files/chmod.js @@ -214,7 +214,7 @@ function calculateMode (mode, metadata) { */ export function createChmod (context) { /** - * @type {import('ipfs-core-types/src/files').API["chmod"]} + * @type {import('ipfs-core-types/src/files').API<{}>["chmod"]} */ async function mfsChmod (path, mode, options = {}) { /** @type {DefaultOptions} */ diff --git a/packages/ipfs-core/src/components/files/cp.js b/packages/ipfs-core/src/components/files/cp.js index 90d0beec0b..694cf55d63 100644 --- a/packages/ipfs-core/src/components/files/cp.js +++ b/packages/ipfs-core/src/components/files/cp.js @@ -47,7 +47,7 @@ const defaultOptions = { */ export function createCp (context) { /** - * @type {import('ipfs-core-types/src/files').API["cp"]} + * @type {import('ipfs-core-types/src/files').API<{}>["cp"]} */ async function mfsCp (from, to, opts = {}) { /** @type {DefaultOptions} */ diff --git a/packages/ipfs-core/src/components/files/flush.js b/packages/ipfs-core/src/components/files/flush.js index 5a74851b99..0bf83baf63 100644 --- a/packages/ipfs-core/src/components/files/flush.js +++ b/packages/ipfs-core/src/components/files/flush.js @@ -21,7 +21,7 @@ const defaultOptions = {} */ export function createFlush (context) { /** - * @type {import('ipfs-core-types/src/files').API["flush"]} + * @type {import('ipfs-core-types/src/files').API<{}>["flush"]} */ async function mfsFlush (path, options = {}) { /** @type {DefaultOptions} */ diff --git a/packages/ipfs-core/src/components/files/ls.js b/packages/ipfs-core/src/components/files/ls.js index 6b99241d58..682307a2c8 100644 --- a/packages/ipfs-core/src/components/files/ls.js +++ b/packages/ipfs-core/src/components/files/ls.js @@ -33,7 +33,7 @@ const toOutput = (fsEntry) => { */ export function createLs (context) { /** - * @type {import('ipfs-core-types/src/files').API["ls"]} + * @type {import('ipfs-core-types/src/files').API<{}>["ls"]} */ async function * mfsLs (path, options = {}) { const mfsPath = await toMfsPath(context, path, options) diff --git a/packages/ipfs-core/src/components/files/mkdir.js b/packages/ipfs-core/src/components/files/mkdir.js index 667e19781a..6768df14af 100644 --- a/packages/ipfs-core/src/components/files/mkdir.js +++ b/packages/ipfs-core/src/components/files/mkdir.js @@ -47,7 +47,7 @@ const defaultOptions = { */ export function createMkdir (context) { /** - * @type {import('ipfs-core-types/src/files').API["mkdir"]} + * @type {import('ipfs-core-types/src/files').API<{}>["mkdir"]} */ async function mfsMkdir (path, options = {}) { /** @type {DefaultOptions} */ diff --git a/packages/ipfs-core/src/components/files/mv.js b/packages/ipfs-core/src/components/files/mv.js index 1c1b6b5f83..b972d251b4 100644 --- a/packages/ipfs-core/src/components/files/mv.js +++ b/packages/ipfs-core/src/components/files/mv.js @@ -34,7 +34,7 @@ const defaultOptions = { */ export function createMv (context) { /** - * @type {import('ipfs-core-types/src/files').API["mv"]} + * @type {import('ipfs-core-types/src/files').API<{}>["mv"]} */ async function mfsMv (from, to, options = {}) { /** @type {DefaultOptions} */ diff --git a/packages/ipfs-core/src/components/files/read.js b/packages/ipfs-core/src/components/files/read.js index 33d275054b..a66ba0d78c 100644 --- a/packages/ipfs-core/src/components/files/read.js +++ b/packages/ipfs-core/src/components/files/read.js @@ -28,7 +28,7 @@ const defaultOptions = { */ export function createRead (context) { /** - * @type {import('ipfs-core-types/src/files').API["read"]} + * @type {import('ipfs-core-types/src/files').API<{}>["read"]} */ function mfsRead (path, options = {}) { /** @type {DefaultOptions} */ diff --git a/packages/ipfs-core/src/components/files/rm.js b/packages/ipfs-core/src/components/files/rm.js index c78e71badc..33d5cb5e43 100644 --- a/packages/ipfs-core/src/components/files/rm.js +++ b/packages/ipfs-core/src/components/files/rm.js @@ -38,7 +38,7 @@ const defaultOptions = { */ export function createRm (context) { /** - * @type {import('ipfs-core-types/src/files').API["rm"]} + * @type {import('ipfs-core-types/src/files').API<{}>["rm"]} */ async function mfsRm (paths, opts = {}) { /** @type {DefaultOptions} */ diff --git a/packages/ipfs-core/src/components/files/stat.js b/packages/ipfs-core/src/components/files/stat.js index 2361dd6025..edeeefeaed 100644 --- a/packages/ipfs-core/src/components/files/stat.js +++ b/packages/ipfs-core/src/components/files/stat.js @@ -33,7 +33,7 @@ const defaultOptions = { */ export function createStat (context) { /** - * @type {import('ipfs-core-types/src/files').API["stat"]} + * @type {import('ipfs-core-types/src/files').API<{}>["stat"]} */ async function mfsStat (path, options = {}) { /** @type {DefaultOptions} */ diff --git a/packages/ipfs-core/src/components/files/touch.js b/packages/ipfs-core/src/components/files/touch.js index e5c22d6035..d72b055815 100644 --- a/packages/ipfs-core/src/components/files/touch.js +++ b/packages/ipfs-core/src/components/files/touch.js @@ -43,7 +43,7 @@ const defaultOptions = { */ export function createTouch (context) { /** - * @type {import('ipfs-core-types/src/files').API["touch"]} + * @type {import('ipfs-core-types/src/files').API<{}>["touch"]} */ async function mfsTouch (path, options = {}) { /** @type {DefaultOptions} */ diff --git a/packages/ipfs-core/src/components/files/write.js b/packages/ipfs-core/src/components/files/write.js index 7152bef9f4..4ddc874aad 100644 --- a/packages/ipfs-core/src/components/files/write.js +++ b/packages/ipfs-core/src/components/files/write.js @@ -82,7 +82,7 @@ const defaultOptions = { */ export function createWrite (context) { /** - * @type {import('ipfs-core-types/src/files').API["write"]} + * @type {import('ipfs-core-types/src/files').API<{}>["write"]} */ async function mfsWrite (path, content, opts = {}) { /** @type {DefaultOptions} */ diff --git a/packages/ipfs-core/src/components/get.js b/packages/ipfs-core/src/components/get.js index 189639dc83..15a6df5142 100644 --- a/packages/ipfs-core/src/components/get.js +++ b/packages/ipfs-core/src/components/get.js @@ -21,11 +21,11 @@ const DEFAULT_COMPRESSION_LEVEL = 6 */ export function createGet ({ repo, preload }) { /** - * @type {import('ipfs-core-types/src/root').API["get"]} + * @type {import('ipfs-core-types/src/root').API<{}>["get"]} */ async function * get (ipfsPath, options = {}) { - if (options.compressionLevel < 0 || options.compressionLevel > 9) { - throw errCode(new Error('Compression level must be between 1 and 9'), 'ERR_INVALID_PARAMS') + if (options.compressionLevel != null && (options.compressionLevel < -1 || options.compressionLevel > 9)) { + throw errCode(new Error('Compression level must be between -1 and 9'), 'ERR_INVALID_PARAMS') } if (options.preload !== false) { diff --git a/packages/ipfs-core/src/components/id.js b/packages/ipfs-core/src/components/id.js index 163c00e805..be35168bba 100644 --- a/packages/ipfs-core/src/components/id.js +++ b/packages/ipfs-core/src/components/id.js @@ -12,7 +12,7 @@ import { NotStartedError } from '../errors.js' */ export function createId ({ peerId, network }) { /** - * @type {import('ipfs-core-types/src/root').API["id"]} + * @type {import('ipfs-core-types/src/root').API<{}>["id"]} */ async function id (options = {}) { // eslint-disable-line require-await if (options.peerId === peerId.toB58String()) { diff --git a/packages/ipfs-core/src/components/key/export.js b/packages/ipfs-core/src/components/key/export.js index 4b7bf1e884..42382d6fd9 100644 --- a/packages/ipfs-core/src/components/key/export.js +++ b/packages/ipfs-core/src/components/key/export.js @@ -6,7 +6,7 @@ import { withTimeoutOption } from 'ipfs-core-utils/with-timeout-option' */ export function createExport ({ keychain }) { /** - * @type {import('ipfs-core-types/src/key').API["export"]} + * @type {import('ipfs-core-types/src/key').API<{}>["export"]} */ const exportKey = (name, password) => keychain.exportKey(name, password) diff --git a/packages/ipfs-core/src/components/key/gen.js b/packages/ipfs-core/src/components/key/gen.js index 31c7be0140..81d9b24047 100644 --- a/packages/ipfs-core/src/components/key/gen.js +++ b/packages/ipfs-core/src/components/key/gen.js @@ -9,7 +9,7 @@ const DEFAULT_KEY_SIZE = 2048 */ export function createGen ({ keychain }) { /** - * @type {import('ipfs-core-types/src/key').API["gen"]} + * @type {import('ipfs-core-types/src/key').API<{}>["gen"]} */ const gen = (name, options = { type: DEFAULT_KEY_TYPE, size: DEFAULT_KEY_SIZE }) => { return keychain.createKey(name, options.type || DEFAULT_KEY_TYPE, options.size || DEFAULT_KEY_SIZE) diff --git a/packages/ipfs-core/src/components/key/import.js b/packages/ipfs-core/src/components/key/import.js index ba4a008ec4..03e80bef4f 100644 --- a/packages/ipfs-core/src/components/key/import.js +++ b/packages/ipfs-core/src/components/key/import.js @@ -6,7 +6,7 @@ import { withTimeoutOption } from 'ipfs-core-utils/with-timeout-option' */ export function createImport ({ keychain }) { /** - * @type {import('ipfs-core-types/src/key').API["import"]} + * @type {import('ipfs-core-types/src/key').API<{}>["import"]} */ const importKey = (name, pem, password) => { return keychain.importKey(name, pem, password) diff --git a/packages/ipfs-core/src/components/key/info.js b/packages/ipfs-core/src/components/key/info.js index 6104209f25..c31f43c14b 100644 --- a/packages/ipfs-core/src/components/key/info.js +++ b/packages/ipfs-core/src/components/key/info.js @@ -6,7 +6,7 @@ import { withTimeoutOption } from 'ipfs-core-utils/with-timeout-option' */ export function createInfo ({ keychain }) { /** - * @type {import('ipfs-core-types/src/key').API["info"]} + * @type {import('ipfs-core-types/src/key').API<{}>["info"]} */ const info = (name) => keychain.findKeyByName(name) diff --git a/packages/ipfs-core/src/components/key/list.js b/packages/ipfs-core/src/components/key/list.js index dfc9050d59..90a9cb3a5f 100644 --- a/packages/ipfs-core/src/components/key/list.js +++ b/packages/ipfs-core/src/components/key/list.js @@ -6,7 +6,7 @@ import { withTimeoutOption } from 'ipfs-core-utils/with-timeout-option' */ export function createList ({ keychain }) { /** - * @type {import('ipfs-core-types/src/key').API["list"]} + * @type {import('ipfs-core-types/src/key').API<{}>["list"]} */ const list = () => keychain.listKeys() diff --git a/packages/ipfs-core/src/components/key/rename.js b/packages/ipfs-core/src/components/key/rename.js index 45a2a63c84..fc4580accd 100644 --- a/packages/ipfs-core/src/components/key/rename.js +++ b/packages/ipfs-core/src/components/key/rename.js @@ -6,7 +6,7 @@ import { withTimeoutOption } from 'ipfs-core-utils/with-timeout-option' */ export function createRename ({ keychain }) { /** - * @type {import('ipfs-core-types/src/key').API["rename"]} + * @type {import('ipfs-core-types/src/key').API<{}>["rename"]} */ const rename = async (oldName, newName) => { const key = await keychain.renameKey(oldName, newName) diff --git a/packages/ipfs-core/src/components/key/rm.js b/packages/ipfs-core/src/components/key/rm.js index 1592d310b4..0f3fbcc25e 100644 --- a/packages/ipfs-core/src/components/key/rm.js +++ b/packages/ipfs-core/src/components/key/rm.js @@ -6,7 +6,7 @@ import { withTimeoutOption } from 'ipfs-core-utils/with-timeout-option' */ export function createRm ({ keychain }) { /** - * @type {import('ipfs-core-types/src/key').API["rm"]} + * @type {import('ipfs-core-types/src/key').API<{}>["rm"]} */ const rm = (name) => keychain.removeKey(name) diff --git a/packages/ipfs-core/src/components/ls.js b/packages/ipfs-core/src/components/ls.js index 572bd28853..4871c4500e 100644 --- a/packages/ipfs-core/src/components/ls.js +++ b/packages/ipfs-core/src/components/ls.js @@ -13,7 +13,7 @@ import { CID } from 'multiformats/cid' */ export function createLs ({ repo, preload }) { /** - * @type {import('ipfs-core-types/src/root').API["ls"]} + * @type {import('ipfs-core-types/src/root').API<{}>["ls"]} */ async function * ls (ipfsPath, options = {}) { const legacyPath = normalizeCidPath(ipfsPath) diff --git a/packages/ipfs-core/src/components/name/index.js b/packages/ipfs-core/src/components/name/index.js index e8c20f087b..4165fc1ef0 100644 --- a/packages/ipfs-core/src/components/name/index.js +++ b/packages/ipfs-core/src/components/name/index.js @@ -10,9 +10,9 @@ export class NameAPI { * @param {import('../../types').Options} config.options * @param {import('ipfs-repo').IPFSRepo} config.repo * @param {import('ipfs-core-utils/multicodecs').Multicodecs} config.codecs - * @param {import('ipfs-core-types/src/root').API["isOnline"]} config.isOnline + * @param {import('ipfs-core-types/src/root').API<{}>["isOnline"]} config.isOnline * @param {import('libp2p/src/keychain')} config.keychain - * @param {import('ipfs-core-types/src/root').API["dns"]} config.dns + * @param {import('ipfs-core-types/src/root').API<{}>["dns"]} config.dns */ constructor ({ dns, ipns, repo, codecs, peerId, isOnline, keychain, options }) { this.publish = createPublish({ ipns, repo, codecs, peerId, isOnline, keychain }) diff --git a/packages/ipfs-core/src/components/name/publish.js b/packages/ipfs-core/src/components/name/publish.js index 5f68214e8a..a03e8b64a0 100644 --- a/packages/ipfs-core/src/components/name/publish.js +++ b/packages/ipfs-core/src/components/name/publish.js @@ -20,7 +20,7 @@ const log = Object.assign(debug('ipfs:name:publish'), { * @param {import('ipfs-repo').IPFSRepo} config.repo * @param {import('ipfs-core-utils/multicodecs').Multicodecs} config.codecs * @param {import('peer-id')} config.peerId - * @param {import('ipfs-core-types/src/root').API["isOnline"]} config.isOnline + * @param {import('ipfs-core-types/src/root').API<{}>["isOnline"]} config.isOnline * @param {import('libp2p/src/keychain')} config.keychain */ export function createPublish ({ ipns, repo, codecs, peerId, isOnline, keychain }) { @@ -44,7 +44,7 @@ export function createPublish ({ ipns, repo, codecs, peerId, isOnline, keychain } /** - * @type {import('ipfs-core-types/src/name').API["publish"]} + * @type {import('ipfs-core-types/src/name').API<{}>["publish"]} */ async function publish (value, options = {}) { const resolve = !(options.resolve === false) diff --git a/packages/ipfs-core/src/components/name/pubsub/cancel.js b/packages/ipfs-core/src/components/name/pubsub/cancel.js index 721c969511..453d53cecc 100644 --- a/packages/ipfs-core/src/components/name/pubsub/cancel.js +++ b/packages/ipfs-core/src/components/name/pubsub/cancel.js @@ -10,7 +10,7 @@ export function createCancel ({ ipns, options }) { const experimental = options.EXPERIMENTAL /** - * @type {import('ipfs-core-types/src/name/pubsub').API["cancel"]} + * @type {import('ipfs-core-types/src/name/pubsub').API<{}>["cancel"]} */ async function cancel (name, options = {}) { // eslint-disable-line require-await const pubsub = getPubsubRouting(ipns, experimental) diff --git a/packages/ipfs-core/src/components/name/pubsub/state.js b/packages/ipfs-core/src/components/name/pubsub/state.js index 9002e39cbf..ffe89c2283 100644 --- a/packages/ipfs-core/src/components/name/pubsub/state.js +++ b/packages/ipfs-core/src/components/name/pubsub/state.js @@ -10,7 +10,7 @@ export function createState ({ ipns, options }) { const experimental = options.EXPERIMENTAL /** - * @type {import('ipfs-core-types/src/name/pubsub').API["state"]} + * @type {import('ipfs-core-types/src/name/pubsub').API<{}>["state"]} */ async function state (_options = {}) { // eslint-disable-line require-await try { diff --git a/packages/ipfs-core/src/components/name/pubsub/subs.js b/packages/ipfs-core/src/components/name/pubsub/subs.js index b66e7db5b3..a395d5d41a 100644 --- a/packages/ipfs-core/src/components/name/pubsub/subs.js +++ b/packages/ipfs-core/src/components/name/pubsub/subs.js @@ -10,7 +10,7 @@ export function createSubs ({ ipns, options }) { const experimental = options.EXPERIMENTAL /** - * @type {import('ipfs-core-types/src/name/pubsub').API["subs"]} + * @type {import('ipfs-core-types/src/name/pubsub').API<{}>["subs"]} */ async function subs (options = {}) { // eslint-disable-line require-await const pubsub = getPubsubRouting(ipns, experimental) diff --git a/packages/ipfs-core/src/components/name/resolve.js b/packages/ipfs-core/src/components/name/resolve.js index 5482cc92dc..f90fdf9c59 100644 --- a/packages/ipfs-core/src/components/name/resolve.js +++ b/packages/ipfs-core/src/components/name/resolve.js @@ -31,15 +31,15 @@ const appendRemainder = (result, remainder) => * IPNS - Inter-Planetary Naming System * * @param {Object} config - * @param {import('ipfs-core-types/src/root').API["dns"]} config.dns + * @param {import('ipfs-core-types/src/root').API<{}>["dns"]} config.dns * @param {import('../ipns').IPNSAPI} config.ipns * @param {import('peer-id')} config.peerId - * @param {import('ipfs-core-types/src/root').API["isOnline"]} config.isOnline + * @param {import('ipfs-core-types/src/root').API<{}>["isOnline"]} config.isOnline * @param {import('../../types').Options} config.options */ export function createResolve ({ dns, ipns, peerId, isOnline, options: { offline } }) { /** - * @type {import('ipfs-core-types/src/name').API["resolve"]} + * @type {import('ipfs-core-types/src/name').API<{}>["resolve"]} */ async function * resolve (name, options = {}) { // eslint-disable-line require-await options = mergeOptions({ diff --git a/packages/ipfs-core/src/components/object/data.js b/packages/ipfs-core/src/components/object/data.js index f890f4e7b1..a3c2e5b09c 100644 --- a/packages/ipfs-core/src/components/object/data.js +++ b/packages/ipfs-core/src/components/object/data.js @@ -10,7 +10,7 @@ export function createData ({ repo, preload }) { const get = createGet({ repo, preload }) /** - * @type {import('ipfs-core-types/src/object').API["data"]} + * @type {import('ipfs-core-types/src/object').API<{}>["data"]} */ async function data (multihash, options = {}) { const node = await get(multihash, options) diff --git a/packages/ipfs-core/src/components/object/get.js b/packages/ipfs-core/src/components/object/get.js index f68e848cd3..c6d4621577 100644 --- a/packages/ipfs-core/src/components/object/get.js +++ b/packages/ipfs-core/src/components/object/get.js @@ -8,7 +8,7 @@ import { withTimeoutOption } from 'ipfs-core-utils/with-timeout-option' */ export function createGet ({ repo, preload }) { /** - * @type {import('ipfs-core-types/src/object').API["get"]} + * @type {import('ipfs-core-types/src/object').API<{}>["get"]} */ async function get (cid, options = {}) { // eslint-disable-line require-await if (options.preload !== false) { diff --git a/packages/ipfs-core/src/components/object/links.js b/packages/ipfs-core/src/components/object/links.js index 237403aba4..c186218675 100644 --- a/packages/ipfs-core/src/components/object/links.js +++ b/packages/ipfs-core/src/components/object/links.js @@ -60,7 +60,7 @@ function findLinks (node, links = []) { */ export function createLinks ({ repo, codecs }) { /** - * @type {import('ipfs-core-types/src/object').API["links"]} + * @type {import('ipfs-core-types/src/object').API<{}>["links"]} */ async function links (cid, options = {}) { const codec = await codecs.getCodec(cid.code) diff --git a/packages/ipfs-core/src/components/object/new.js b/packages/ipfs-core/src/components/object/new.js index 0fac9a6d12..28ec3c1a62 100644 --- a/packages/ipfs-core/src/components/object/new.js +++ b/packages/ipfs-core/src/components/object/new.js @@ -11,7 +11,7 @@ import { CID } from 'multiformats/cid' */ export function createNew ({ repo, preload }) { /** - * @type {import('ipfs-core-types/src/object').API["new"]} + * @type {import('ipfs-core-types/src/object').API<{}>["new"]} */ async function _new (options = {}) { let data diff --git a/packages/ipfs-core/src/components/object/patch/add-link.js b/packages/ipfs-core/src/components/object/patch/add-link.js index 620a859d06..8f1e52aade 100644 --- a/packages/ipfs-core/src/components/object/patch/add-link.js +++ b/packages/ipfs-core/src/components/object/patch/add-link.js @@ -12,7 +12,7 @@ export function createAddLink ({ repo, preload }) { const put = createPut({ repo, preload }) /** - * @type {import('ipfs-core-types/src/object/patch').API["addLink"]} + * @type {import('ipfs-core-types/src/object/patch').API<{}>["addLink"]} */ async function addLink (cid, link, options = {}) { const node = await get(cid, options) diff --git a/packages/ipfs-core/src/components/object/patch/append-data.js b/packages/ipfs-core/src/components/object/patch/append-data.js index e6e1272392..24919859a3 100644 --- a/packages/ipfs-core/src/components/object/patch/append-data.js +++ b/packages/ipfs-core/src/components/object/patch/append-data.js @@ -13,7 +13,7 @@ export function createAppendData ({ repo, preload }) { const put = createPut({ repo, preload }) /** - * @type {import('ipfs-core-types/src/object/patch').API["appendData"]} + * @type {import('ipfs-core-types/src/object/patch').API<{}>["appendData"]} */ async function appendData (cid, data, options = {}) { const node = await get(cid, options) diff --git a/packages/ipfs-core/src/components/object/patch/rm-link.js b/packages/ipfs-core/src/components/object/patch/rm-link.js index b351f630ef..1408d95d10 100644 --- a/packages/ipfs-core/src/components/object/patch/rm-link.js +++ b/packages/ipfs-core/src/components/object/patch/rm-link.js @@ -12,7 +12,7 @@ export function createRmLink ({ repo, preload }) { const put = createPut({ repo, preload }) /** - * @type {import('ipfs-core-types/src/object/patch').API["rmLink"]} + * @type {import('ipfs-core-types/src/object/patch').API<{}>["rmLink"]} */ async function rmLink (multihash, linkRef, options = {}) { const node = await get(multihash, options) diff --git a/packages/ipfs-core/src/components/object/patch/set-data.js b/packages/ipfs-core/src/components/object/patch/set-data.js index e8044e7e29..6d2bb56b6e 100644 --- a/packages/ipfs-core/src/components/object/patch/set-data.js +++ b/packages/ipfs-core/src/components/object/patch/set-data.js @@ -12,7 +12,7 @@ export function createSetData ({ repo, preload }) { const put = createPut({ repo, preload }) /** - * @type {import('ipfs-core-types/src/object/patch').API["setData"]} + * @type {import('ipfs-core-types/src/object/patch').API<{}>["setData"]} */ async function setData (cid, data, options = {}) { const node = await get(cid, options) diff --git a/packages/ipfs-core/src/components/object/put.js b/packages/ipfs-core/src/components/object/put.js index 42e732d133..5dc652fa4a 100644 --- a/packages/ipfs-core/src/components/object/put.js +++ b/packages/ipfs-core/src/components/object/put.js @@ -10,7 +10,7 @@ import { withTimeoutOption } from 'ipfs-core-utils/with-timeout-option' */ export function createPut ({ repo, preload }) { /** - * @type {import('ipfs-core-types/src/object').API["put"]} + * @type {import('ipfs-core-types/src/object').API<{}>["put"]} */ async function put (obj, options = {}) { const release = await repo.gcLock.readLock() diff --git a/packages/ipfs-core/src/components/object/stat.js b/packages/ipfs-core/src/components/object/stat.js index 78dd15a37e..b247a302aa 100644 --- a/packages/ipfs-core/src/components/object/stat.js +++ b/packages/ipfs-core/src/components/object/stat.js @@ -11,7 +11,7 @@ export function createStat ({ repo, preload }) { const get = createGet({ repo, preload }) /** - * @type {import('ipfs-core-types/src/object').API["stat"]} + * @type {import('ipfs-core-types/src/object').API<{}>["stat"]} */ async function stat (cid, options = {}) { const node = await get(cid, options) diff --git a/packages/ipfs-core/src/components/pin/add-all.js b/packages/ipfs-core/src/components/pin/add-all.js index dd2b6852dd..5101e01d55 100644 --- a/packages/ipfs-core/src/components/pin/add-all.js +++ b/packages/ipfs-core/src/components/pin/add-all.js @@ -24,7 +24,7 @@ import { PinTypes } from 'ipfs-repo/pin-types' */ export function createAddAll ({ repo, codecs }) { /** - * @type {import('ipfs-core-types/src/pin').API["addAll"]} + * @type {import('ipfs-core-types/src/pin').API<{}>["addAll"]} */ async function * addAll (source, options = {}) { /** diff --git a/packages/ipfs-core/src/components/pin/add.js b/packages/ipfs-core/src/components/pin/add.js index 545565e8d6..0beb9abfe2 100644 --- a/packages/ipfs-core/src/components/pin/add.js +++ b/packages/ipfs-core/src/components/pin/add.js @@ -7,7 +7,7 @@ import { CID } from 'multiformats/cid' */ export function createAdd ({ addAll }) { /** - * @type {import('ipfs-core-types/src/pin').API["add"]} + * @type {import('ipfs-core-types/src/pin').API<{}>["add"]} */ return (path, options = {}) => { let iter diff --git a/packages/ipfs-core/src/components/pin/ls.js b/packages/ipfs-core/src/components/pin/ls.js index 6b0aec728f..1fe59844d8 100644 --- a/packages/ipfs-core/src/components/pin/ls.js +++ b/packages/ipfs-core/src/components/pin/ls.js @@ -36,7 +36,7 @@ function toPin (type, cid, metadata) { */ export function createLs ({ repo, codecs }) { /** - * @type {import('ipfs-core-types/src/pin').API["ls"]} + * @type {import('ipfs-core-types/src/pin').API<{}>["ls"]} */ async function * ls (options = {}) { /** @type {import('ipfs-core-types/src/pin').PinQueryType} */ diff --git a/packages/ipfs-core/src/components/pin/rm-all.js b/packages/ipfs-core/src/components/pin/rm-all.js index be0cb5b2f3..1f3e0a5605 100644 --- a/packages/ipfs-core/src/components/pin/rm-all.js +++ b/packages/ipfs-core/src/components/pin/rm-all.js @@ -10,7 +10,7 @@ import { PinTypes } from 'ipfs-repo/pin-types' */ export function createRmAll ({ repo, codecs }) { /** - * @type {import('ipfs-core-types/src/pin').API["rmAll"]} + * @type {import('ipfs-core-types/src/pin').API<{}>["rmAll"]} */ async function * rmAll (source, _options = {}) { const release = await repo.gcLock.readLock() diff --git a/packages/ipfs-core/src/components/pin/rm.js b/packages/ipfs-core/src/components/pin/rm.js index 337e2c8d03..69f328f4aa 100644 --- a/packages/ipfs-core/src/components/pin/rm.js +++ b/packages/ipfs-core/src/components/pin/rm.js @@ -2,11 +2,11 @@ import last from 'it-last' /** * @param {Object} config - * @param {import('ipfs-core-types/src/pin').API["rmAll"]} config.rmAll + * @param {import('ipfs-core-types/src/pin').API<{}>["rmAll"]} config.rmAll */ export function createRm ({ rmAll }) { /** - * @type {import('ipfs-core-types/src/pin').API["rm"]} + * @type {import('ipfs-core-types/src/pin').API<{}>["rm"]} */ async function rm (path, options = {}) { // @ts-ignore return value of last can be undefined diff --git a/packages/ipfs-core/src/components/ping.js b/packages/ipfs-core/src/components/ping.js index cd8412bb60..529a13e434 100644 --- a/packages/ipfs-core/src/components/ping.js +++ b/packages/ipfs-core/src/components/ping.js @@ -39,7 +39,7 @@ const basePacket = { success: true, time: 0, text: '' } */ export function createPing ({ network }) { /** - * @type {import('ipfs-core-types/src/root').API["ping"]} + * @type {import('ipfs-core-types/src/root').API<{}>["ping"]} */ async function * ping (peerId, options = {}) { const { libp2p } = await network.use() diff --git a/packages/ipfs-core/src/components/pubsub.js b/packages/ipfs-core/src/components/pubsub.js index 589f89edab..0495400dc4 100644 --- a/packages/ipfs-core/src/components/pubsub.js +++ b/packages/ipfs-core/src/components/pubsub.js @@ -20,7 +20,7 @@ export function createPubsub ({ network, config }) { } /** - * @type {import('ipfs-core-types/src/pubsub').API["subscribe"]} + * @type {import('ipfs-core-types/src/pubsub').API<{}>["subscribe"]} */ async function subscribe (topic, handler, options = {}) { const { libp2p } = await network.use(options) @@ -29,7 +29,7 @@ export function createPubsub ({ network, config }) { } /** - * @type {import('ipfs-core-types/src/pubsub').API["unsubscribe"]} + * @type {import('ipfs-core-types/src/pubsub').API<{}>["unsubscribe"]} */ async function unsubscribe (topic, handler, options = {}) { const { libp2p } = await network.use(options) @@ -38,7 +38,7 @@ export function createPubsub ({ network, config }) { } /** - * @type {import('ipfs-core-types/src/pubsub').API["publish"]} + * @type {import('ipfs-core-types/src/pubsub').API<{}>["publish"]} */ async function publish (topic, data, options = {}) { const { libp2p } = await network.use(options) @@ -49,7 +49,7 @@ export function createPubsub ({ network, config }) { } /** - * @type {import('ipfs-core-types/src/pubsub').API["ls"]} + * @type {import('ipfs-core-types/src/pubsub').API<{}>["ls"]} */ async function ls (options = {}) { const { libp2p } = await network.use(options) @@ -57,7 +57,7 @@ export function createPubsub ({ network, config }) { } /** - * @type {import('ipfs-core-types/src/pubsub').API["peers"]} + * @type {import('ipfs-core-types/src/pubsub').API<{}>["peers"]} */ async function peers (topic, options = {}) { const { libp2p } = await network.use(options) diff --git a/packages/ipfs-core/src/components/refs/index.js b/packages/ipfs-core/src/components/refs/index.js index a1560a9477..6962dd7d50 100644 --- a/packages/ipfs-core/src/components/refs/index.js +++ b/packages/ipfs-core/src/components/refs/index.js @@ -29,12 +29,12 @@ export const Format = { * @param {Object} config * @param {import('ipfs-repo').IPFSRepo} config.repo * @param {import('ipfs-core-utils/multicodecs').Multicodecs} config.codecs - * @param {import('ipfs-core-types/src/root').API["resolve"]} config.resolve + * @param {import('ipfs-core-types/src/root').API<{}>["resolve"]} config.resolve * @param {import('../../types').Preload} config.preload */ export function createRefs ({ repo, codecs, resolve, preload }) { /** - * @type {import('ipfs-core-types/src/refs').API["refs"]} + * @type {import('ipfs-core-types/src/refs').API<{}>["refs"]} */ async function * refs (ipfsPath, options = {}) { if (options.maxDepth === 0) { @@ -53,8 +53,13 @@ export function createRefs ({ repo, codecs, resolve, preload }) { if (options.timeout) { const controller = new TimeoutController(options.timeout) + const signals = [controller.signal] - options.signal = anySignal([options.signal, controller.signal]) + if (options.signal) { + signals.push(options.signal) + } + + options.signal = anySignal(signals) } /** @type {(string|CID)[]} */ @@ -98,7 +103,7 @@ function getFullPath (preload, ipfsPath, options) { /** * Get a stream of refs at the given path * - * @param {import('ipfs-core-types/src/root').API["resolve"]} resolve + * @param {import('ipfs-core-types/src/root').API<{}>["resolve"]} resolve * @param {import('ipfs-repo').IPFSRepo} repo * @param {import('ipfs-core-utils/multicodecs').Multicodecs} codecs * @param {string} path diff --git a/packages/ipfs-core/src/components/refs/local.js b/packages/ipfs-core/src/components/refs/local.js index fdbbca6bd1..594bd7e355 100644 --- a/packages/ipfs-core/src/components/refs/local.js +++ b/packages/ipfs-core/src/components/refs/local.js @@ -6,7 +6,7 @@ import { withTimeoutOption } from 'ipfs-core-utils/with-timeout-option' */ export function createLocal ({ repo }) { /** - * @type {import('ipfs-core-types/src/refs').API["local"]} + * @type {import('ipfs-core-types/src/refs').API<{}>["local"]} */ async function * refsLocal (options = {}) { for await (const cid of repo.blocks.queryKeys({}, { signal: options.signal })) { diff --git a/packages/ipfs-core/src/components/repo/gc.js b/packages/ipfs-core/src/components/repo/gc.js index ef7c1a30d7..ac35c3ad8e 100644 --- a/packages/ipfs-core/src/components/repo/gc.js +++ b/packages/ipfs-core/src/components/repo/gc.js @@ -22,7 +22,7 @@ const log = debug('ipfs:repo:gc') */ export function createGc ({ repo, hashers }) { /** - * @type {import('ipfs-core-types/src/repo').API["gc"]} + * @type {import('ipfs-core-types/src/repo').API<{}>["gc"]} */ async function * gc (options = {}) { const start = Date.now() diff --git a/packages/ipfs-core/src/components/repo/stat.js b/packages/ipfs-core/src/components/repo/stat.js index 00f6b0b31f..87429f3caf 100644 --- a/packages/ipfs-core/src/components/repo/stat.js +++ b/packages/ipfs-core/src/components/repo/stat.js @@ -6,7 +6,7 @@ import { withTimeoutOption } from 'ipfs-core-utils/with-timeout-option' */ export function createStat ({ repo }) { /** - * @type {import('ipfs-core-types/src/repo').API["stat"]} + * @type {import('ipfs-core-types/src/repo').API<{}>["stat"]} */ async function stat (options = {}) { const stats = await repo.stat() diff --git a/packages/ipfs-core/src/components/repo/version.js b/packages/ipfs-core/src/components/repo/version.js index 9e8d0e2535..ed9b76ffa9 100644 --- a/packages/ipfs-core/src/components/repo/version.js +++ b/packages/ipfs-core/src/components/repo/version.js @@ -7,7 +7,7 @@ import { repoVersion } from 'ipfs-repo/constants' */ export function createVersion ({ repo }) { /** - * @type {import('ipfs-core-types/src/repo').API["version"]} + * @type {import('ipfs-core-types/src/repo').API<{}>["version"]} */ async function version (options = {}) { try { diff --git a/packages/ipfs-core/src/components/resolve.js b/packages/ipfs-core/src/components/resolve.js index f1748d0be1..fd8ab5e06b 100644 --- a/packages/ipfs-core/src/components/resolve.js +++ b/packages/ipfs-core/src/components/resolve.js @@ -13,7 +13,7 @@ import { resolve as res } from '../utils.js' */ export function createResolve ({ repo, codecs, bases, name }) { /** - * @type {import('ipfs-core-types/src/root').API["resolve"]} + * @type {import('ipfs-core-types/src/root').API<{}>["resolve"]} */ async function resolve (path, opts = {}) { if (!isIpfs.path(path)) { diff --git a/packages/ipfs-core/src/components/start.js b/packages/ipfs-core/src/components/start.js index b394fbe17e..700d31ddab 100644 --- a/packages/ipfs-core/src/components/start.js +++ b/packages/ipfs-core/src/components/start.js @@ -15,7 +15,7 @@ import { Service } from '../utils/service.js' */ export function createStart ({ network, preload, peerId, keychain, repo, ipns, mfsPreload, print, hashers, options }) { /** - * @type {import('ipfs-core-types/src/root').API["start"]} + * @type {import('ipfs-core-types/src/root').API<{}>["start"]} */ const start = async () => { const { libp2p } = await Service.start(network, { diff --git a/packages/ipfs-core/src/components/stats/bw.js b/packages/ipfs-core/src/components/stats/bw.js index 815036aa81..3bff92b1d9 100644 --- a/packages/ipfs-core/src/components/stats/bw.js +++ b/packages/ipfs-core/src/components/stats/bw.js @@ -1,10 +1,11 @@ import parseDuration from 'parse-duration' import errCode from 'err-code' import { withTimeoutOption } from 'ipfs-core-utils/with-timeout-option' +import PeerId from 'peer-id' /** * @typedef {Object} BWOptions - * @property {PeerId} [peer] - Specifies a peer to print bandwidth for + * @property {string} [peer] - Specifies a peer to print bandwidth for * @property {string} [proto] - Specifies a protocol to print bandwidth for * @property {boolean} [poll] - Is used to yield bandwidth info at an interval * @property {number|string} [interval=1000] - The time interval to wait between updating output, if `poll` is `true`. @@ -16,7 +17,6 @@ import { withTimeoutOption } from 'ipfs-core-utils/with-timeout-option' * @property {number} rateOut * * @typedef {import('libp2p')} libp2p - * @typedef {import('peer-id')} PeerId * @typedef {import('multiformats/cid').CID} CID * @typedef {import('ipfs-core-types/src/utils').AbortOptions} AbortOptions */ @@ -32,7 +32,7 @@ function getBandwidthStats (libp2p, opts) { if (!libp2p.metrics) { stats = undefined } else if (opts.peer) { - stats = libp2p.metrics.forPeer(opts.peer) + stats = libp2p.metrics.forPeer(PeerId.parse(opts.peer)) } else if (opts.proto) { stats = libp2p.metrics.forProtocol(opts.proto) } else { @@ -64,7 +64,7 @@ function getBandwidthStats (libp2p, opts) { */ export function createBw ({ network }) { /** - * @type {import('ipfs-core-types/src/stats').API["bw"]} + * @type {import('ipfs-core-types/src/stats').API<{}>["bw"]} */ const bw = async function * (options = {}) { const { libp2p } = await network.use(options) diff --git a/packages/ipfs-core/src/components/stop.js b/packages/ipfs-core/src/components/stop.js index dec289488c..12e13228db 100644 --- a/packages/ipfs-core/src/components/stop.js +++ b/packages/ipfs-core/src/components/stop.js @@ -10,7 +10,7 @@ import { Service } from '../utils/service.js' */ export function createStop ({ network, preload, ipns, repo, mfsPreload }) { /** - * @type {import('ipfs-core-types/src/root').API["stop"]} + * @type {import('ipfs-core-types/src/root').API<{}>["stop"]} */ const stop = async () => { await Promise.all([ diff --git a/packages/ipfs-core/src/components/swarm/addrs.js b/packages/ipfs-core/src/components/swarm/addrs.js index dd20ad1c09..bb94a9f22a 100644 --- a/packages/ipfs-core/src/components/swarm/addrs.js +++ b/packages/ipfs-core/src/components/swarm/addrs.js @@ -6,7 +6,7 @@ import { withTimeoutOption } from 'ipfs-core-utils/with-timeout-option' */ export function createAddrs ({ network }) { /** - * @type {import('ipfs-core-types/src/swarm').API["addrs"]} + * @type {import('ipfs-core-types/src/swarm').API<{}>["addrs"]} */ async function addrs (options = {}) { // eslint-disable-line require-await const peers = [] diff --git a/packages/ipfs-core/src/components/swarm/connect.js b/packages/ipfs-core/src/components/swarm/connect.js index b6a01be183..57ac1de509 100644 --- a/packages/ipfs-core/src/components/swarm/connect.js +++ b/packages/ipfs-core/src/components/swarm/connect.js @@ -6,7 +6,7 @@ import { withTimeoutOption } from 'ipfs-core-utils/with-timeout-option' */ export function createConnect ({ network }) { /** - * @type {import('ipfs-core-types/src/swarm').API["connect"]} + * @type {import('ipfs-core-types/src/swarm').API<{}>["connect"]} */ async function connect (addr, options = {}) { const { libp2p } = await network.use(options) diff --git a/packages/ipfs-core/src/components/swarm/disconnect.js b/packages/ipfs-core/src/components/swarm/disconnect.js index c023b616a7..57fa7562da 100644 --- a/packages/ipfs-core/src/components/swarm/disconnect.js +++ b/packages/ipfs-core/src/components/swarm/disconnect.js @@ -6,7 +6,7 @@ import { withTimeoutOption } from 'ipfs-core-utils/with-timeout-option' */ export function createDisconnect ({ network }) { /** - * @type {import('ipfs-core-types/src/swarm').API["disconnect"]} + * @type {import('ipfs-core-types/src/swarm').API<{}>["disconnect"]} */ async function disconnect (addr, options = {}) { const { libp2p } = await network.use(options) diff --git a/packages/ipfs-core/src/components/swarm/local-addrs.js b/packages/ipfs-core/src/components/swarm/local-addrs.js index 61011be995..41fbe36ccc 100644 --- a/packages/ipfs-core/src/components/swarm/local-addrs.js +++ b/packages/ipfs-core/src/components/swarm/local-addrs.js @@ -6,7 +6,7 @@ import { withTimeoutOption } from 'ipfs-core-utils/with-timeout-option' */ export function createLocalAddrs ({ network }) { /** - * @type {import('ipfs-core-types/src/swarm').API["localAddrs"]} + * @type {import('ipfs-core-types/src/swarm').API<{}>["localAddrs"]} */ async function localAddrs (options = {}) { const { libp2p } = await network.use(options) diff --git a/packages/ipfs-core/src/components/swarm/peers.js b/packages/ipfs-core/src/components/swarm/peers.js index 322b029501..19e9f166f7 100644 --- a/packages/ipfs-core/src/components/swarm/peers.js +++ b/packages/ipfs-core/src/components/swarm/peers.js @@ -6,7 +6,7 @@ import { withTimeoutOption } from 'ipfs-core-utils/with-timeout-option' */ export function createPeers ({ network }) { /** - * @type {import('ipfs-core-types/src/swarm').API["peers"]} + * @type {import('ipfs-core-types/src/swarm').API<{}>["peers"]} */ async function peers (options = {}) { const { libp2p } = await network.use(options) diff --git a/packages/ipfs-core/src/components/version.js b/packages/ipfs-core/src/components/version.js index 32766e5f79..efd361a211 100644 --- a/packages/ipfs-core/src/components/version.js +++ b/packages/ipfs-core/src/components/version.js @@ -7,7 +7,7 @@ import { withTimeoutOption } from 'ipfs-core-utils/with-timeout-option' */ export function createVersion ({ repo }) { /** - * @type {import('ipfs-core-types/src/root').API["version"]} + * @type {import('ipfs-core-types/src/root').API<{}>["version"]} */ async function version (_options = {}) { const repoVersion = await repo.version.get() diff --git a/packages/ipfs-core/src/version.js b/packages/ipfs-core/src/version.js index 422ff78580..55230f8d72 100644 --- a/packages/ipfs-core/src/version.js +++ b/packages/ipfs-core/src/version.js @@ -1,4 +1,4 @@ -export const ipfsCore = '0.12.1' +export const ipfsCore = '0.12.2' export const commit = '' -export const interfaceIpfsCore = '^0.152.1' +export const interfaceIpfsCore = '^0.152.2' diff --git a/packages/ipfs-grpc-client/src/core-api/add-all.js b/packages/ipfs-grpc-client/src/core-api/add-all.js index 5304123f53..b3d69d2055 100644 --- a/packages/ipfs-grpc-client/src/core-api/add-all.js +++ b/packages/ipfs-grpc-client/src/core-api/add-all.js @@ -111,7 +111,7 @@ async function sendFiles (stream, sink) { */ export function grpcAddAll (grpc, service, opts) { /** - * @type {import('ipfs-core-types/src/root').API["addAll"]} + * @type {import('ipfs-core-types/src/root').API<{}>["addAll"]} */ async function * addAll (stream, options = {}) { const { diff --git a/packages/ipfs-grpc-client/src/core-api/files/ls.js b/packages/ipfs-grpc-client/src/core-api/files/ls.js index 02dc92b0d0..1ad8522567 100644 --- a/packages/ipfs-grpc-client/src/core-api/files/ls.js +++ b/packages/ipfs-grpc-client/src/core-api/files/ls.js @@ -9,7 +9,7 @@ import { withTimeoutOption } from 'ipfs-core-utils/with-timeout-option' */ export function grpcMfsLs (grpc, service, opts) { /** - * @type {import('ipfs-core-types/src/files').API["ls"]} + * @type {import('ipfs-core-types/src/files').API<{}>["ls"]} */ async function * mfsLs (path, options = {}) { const request = { diff --git a/packages/ipfs-grpc-client/src/core-api/files/write.js b/packages/ipfs-grpc-client/src/core-api/files/write.js index 6ad2674659..f3692fe451 100644 --- a/packages/ipfs-grpc-client/src/core-api/files/write.js +++ b/packages/ipfs-grpc-client/src/core-api/files/write.js @@ -23,7 +23,7 @@ async function * stream (path, content) { */ export function grpcMfsWrite (grpc, service, opts) { /** - * @type {import('ipfs-core-types/src/files').API["write"]} + * @type {import('ipfs-core-types/src/files').API<{}>["write"]} */ async function mfsWrite (path, content, options = {}) { /** diff --git a/packages/ipfs-grpc-client/src/core-api/id.js b/packages/ipfs-grpc-client/src/core-api/id.js index b4ff3c5160..a5446c80b6 100644 --- a/packages/ipfs-grpc-client/src/core-api/id.js +++ b/packages/ipfs-grpc-client/src/core-api/id.js @@ -10,7 +10,7 @@ import { Multiaddr } from 'multiaddr' */ export function grpcId (grpc, service, opts) { /** - * @type {import('ipfs-core-types/src/root').API["id"]} + * @type {import('ipfs-core-types/src/root').API<{}>["id"]} */ async function id (options = {}) { const request = {} diff --git a/packages/ipfs-grpc-client/src/core-api/pubsub/subscribe.js b/packages/ipfs-grpc-client/src/core-api/pubsub/subscribe.js index 3f37669f53..a8c36acad6 100644 --- a/packages/ipfs-grpc-client/src/core-api/pubsub/subscribe.js +++ b/packages/ipfs-grpc-client/src/core-api/pubsub/subscribe.js @@ -10,7 +10,7 @@ import defer from 'p-defer' */ export function grpcPubsubSubscribe (grpc, service, opts) { /** - * @type {import('ipfs-core-types/src/pubsub').API["subscribe"]} + * @type {import('ipfs-core-types/src/pubsub').API<{}>["subscribe"]} */ async function pubsubSubscribe (topic, handler, options = {}) { const request = { diff --git a/packages/ipfs-grpc-client/src/core-api/pubsub/unsubscribe.js b/packages/ipfs-grpc-client/src/core-api/pubsub/unsubscribe.js index 6cde404225..b356a7e832 100644 --- a/packages/ipfs-grpc-client/src/core-api/pubsub/unsubscribe.js +++ b/packages/ipfs-grpc-client/src/core-api/pubsub/unsubscribe.js @@ -10,7 +10,7 @@ import { subscriptions } from './subscriptions.js' */ export function grpcPubsubUnsubscribe (grpc, service, opts) { /** - * @type {import('ipfs-core-types/src/pubsub').API["unsubscribe"]} + * @type {import('ipfs-core-types/src/pubsub').API<{}>["unsubscribe"]} */ async function pubsubUnsubscribe (topic, handler, options = {}) { const handlers = [] diff --git a/packages/ipfs-http-server/src/version.js b/packages/ipfs-http-server/src/version.js index 7a047f926f..807107a9a5 100644 --- a/packages/ipfs-http-server/src/version.js +++ b/packages/ipfs-http-server/src/version.js @@ -1,2 +1,2 @@ -export const ipfsHttpClient = '^54.0.1' +export const ipfsHttpClient = '^54.0.2' diff --git a/packages/ipfs/src/package.js b/packages/ipfs/src/package.js index d6e6eb0d88..5d1cd18769 100644 --- a/packages/ipfs/src/package.js +++ b/packages/ipfs/src/package.js @@ -1,4 +1,4 @@ export const name = 'ipfs' -export const version = '0.60.1' +export const version = '0.60.2' export const node = '>=14.0.0'