-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.d.ts
56 lines (49 loc) · 1.54 KB
/
types.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import type { Multiaddr, BlockCodec, MultihashHasher, MultibaseCodec } from './deps.ts'
import type { IPFS } from "https://esm.sh/ipfs-core-types@0.14.0"
export interface AbortOptions {
/**
* Can be provided to a function that starts a long running task, which will
* be aborted when signal is triggered.
*/
signal?: AbortSignal
/**
* Can be provided to a function that starts a long running task, which will
* be aborted after provided timeout (in ms).
*/
timeout?: number
}
export interface Options {
host?: string
port?: number
protocol?: string
headers?: Headers | Record<string, string>
timeout?: number | string
apiPath?: string
url?: URL|string|Multiaddr
ipld?: Partial<IPLDOptions>
}
export interface LoadBaseFn { (codeOrName: number | string): Promise<MultibaseCodec<any>> }
export interface LoadCodecFn { (codeOrName: number | string): Promise<BlockCodec<any, any>> }
export interface LoadHasherFn { (codeOrName: number | string): Promise<MultihashHasher> }
export interface IPLDOptions {
loadBase: LoadBaseFn
loadCodec: LoadCodecFn
loadHasher: LoadHasherFn
bases: Array<MultibaseCodec<any>>
codecs: Array<BlockCodec<any, any>>
hashers: MultihashHasher[]
}
export interface HTTPClientExtraOptions {
headers?: Record<string, string>
searchParams?: URLSearchParams
}
export interface EndpointConfig {
host: string
port: string
protocol: string
pathname: string
'api-path': string
}
export interface IPFSHTTPClient extends IPFS<HTTPClientExtraOptions> {
getEndpointConfig: () => EndpointConfig
}