diff --git a/packages/ipfs-core-types/src/index.d.ts b/packages/ipfs-core-types/src/index.d.ts index fcfc03336a..de6dad2782 100644 --- a/packages/ipfs-core-types/src/index.d.ts +++ b/packages/ipfs-core-types/src/index.d.ts @@ -26,25 +26,25 @@ interface RefsAPI extends Refs { local: Local } -export interface IPFS extends RootAPI { - bitswap: BitswapAPI - block: BlockAPI - bootstrap: BootstrapAPI - config: ConfigAPI - dag: DAGAPI - dht: DHTAPI - diag: DiagAPI - files: FilesAPI - key: KeyAPI - log: LogAPI - name: NameAPI - object: ObjectAPI - pin: PinAPI - pubsub: PubsubAPI - refs: RefsAPI - repo: RepoAPI - stats: StatsAPI - swarm: SwarmAPI +export interface IPFS extends RootAPI { + bitswap: BitswapAPI + block: BlockAPI + bootstrap: BootstrapAPI + config: ConfigAPI + dag: DAGAPI + dht: DHTAPI + diag: DiagAPI + files: FilesAPI + key: KeyAPI + log: LogAPI + name: NameAPI + object: ObjectAPI + pin: PinAPI + pubsub: PubsubAPI + refs: RefsAPI + repo: RepoAPI + stats: StatsAPI + swarm: SwarmAPI bases: Bases codecs: Codecs hashers: Hashers diff --git a/packages/ipfs-http-client/src/index.js b/packages/ipfs-http-client/src/index.js index 562b0a7944..521aaa79a5 100644 --- a/packages/ipfs-http-client/src/index.js +++ b/packages/ipfs-http-client/src/index.js @@ -20,6 +20,7 @@ const { base58btc } = require('multiformats/bases/base58') * @typedef {import('./types').EndpointConfig} EndpointConfig * @typedef {import('./types').Options} Options * @typedef {import('multiformats/codecs/interface').BlockCodec} BlockCodec + * @typedef {import('./types').IPFSHTTPClient} IPFSHTTPClient */ /** @@ -49,7 +50,7 @@ function create (options = {}) { loadHasher: options.ipld && options.ipld.loadHasher }) - /** @type {import('ipfs-core-types').IPFS & { getEndpointConfig: () => EndpointConfig }} */ + /** @type {IPFSHTTPClient} */ const client = { add: require('./add')(options), addAll: require('./add-all')(options), diff --git a/packages/ipfs-http-client/src/types.d.ts b/packages/ipfs-http-client/src/types.d.ts index f2403a6f73..e0be2081b5 100644 --- a/packages/ipfs-http-client/src/types.d.ts +++ b/packages/ipfs-http-client/src/types.d.ts @@ -2,6 +2,7 @@ import { Agent as HttpAgent } from 'http' import { Agent as HttpsAgent } from 'https' import { Multiaddr } from 'multiaddr' import type { BlockCodec } from 'multiformats/codecs/interface' +import type { IPFS } from 'ipfs-core-types' export interface Options { host?: string @@ -40,3 +41,7 @@ export interface EndpointConfig { pathname: string 'api-path': string } + +export interface IPFSHTTPClient extends IPFS { + getEndpointConfig: () => EndpointConfig +}