-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathschema.ts
71 lines (61 loc) · 1.46 KB
/
schema.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import { TrackerStatus } from './schema'
export type { TrackerStatus } from '@nftstorage/ipfs-cluster/src/interface'
export interface Response {
statusCode: number
body: any
}
export interface ValidationError {
code: string
message: string
}
export interface Pin {
cid: string
status: 'queued' | 'pinning' | 'pinned' | 'failed' | 'unpinned'
created: string
delegates?: Set<string>
}
export interface PeerMapValue {
'peername': string
'ipfs_peer_id': string
'ipfs_peer_addresses': string[]
'status': TrackerStatus
'timestamp': string
'error': string
'attempt_count': number
'priority_pin': boolean
}
export interface ClusterGetResponseBody {
'cid': string
'name': ''
'allocations': []
'origins': []
'created': string
'metadata': Record<string, any>
'peer_map': Record<string, PeerMapValue>
}
export interface ClusterAddResponseBody {
replication_factor_min: -1
replication_factor_max: -1
name: string
mode: 'recursive'
shard_size: 0
user_allocations: null
expire_at: '0001-01-01T00:00:00Z' // we don't support exiring pins, so always return this value.
metadata: {}
pin_update: null
origins: string[]
cid: string
type: 'pin'
allocations: []
max_depth: -1
reference: null
timestamp: string // "2022-08-11T12:39:50.772359472Z"
}
export type ResponseBody = Object
export class ErrorCode extends Error {
code: string
constructor (code: string, message: string) {
super(message)
this.code = code
}
}