-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtypes.ts
More file actions
46 lines (38 loc) · 854 Bytes
/
types.ts
File metadata and controls
46 lines (38 loc) · 854 Bytes
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
export type FileKind = 'file' | 'directory'
export interface FileMetadata {
name: string
eTag?: string
size?: number
lastModified?: string
sourceId: string /// the source URL or path
kind: FileKind
}
export interface SourcePart {
text: string
sourceId: string
}
export interface Version {
label: string
sourceId: string
}
export interface VersionsData {
label: string // "version" or "branch"
versions: Version[]
}
interface BaseSource {
sourceId: string
sourceParts: SourcePart[]
versions?: VersionsData
}
export interface FileSource extends BaseSource {
kind: 'file'
fileName: string
resolveUrl: string
requestInit?: RequestInit
}
export interface DirSource extends BaseSource {
kind: 'directory'
prefix: string,
listFiles: () => Promise<FileMetadata[]>
}
export type Source = FileSource | DirSource