-
Notifications
You must be signed in to change notification settings - Fork 6
/
types.ts
52 lines (45 loc) · 1.17 KB
/
types.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
import type { DirectFileManipulatorOptions } from "./lib/src/API/DirectFileManipulator.ts";
export interface Config {
peers: PeerConf[];
}
export type PeerConf = PeerStorageConf | PeerCouchDBConf;
export interface PeerStorageConf {
scanOfflineChanges?: boolean;
type: "storage";
group?: string;
name: string;
baseDir: string;
processor?: {
cmd: string,
args: string[]
}
useChokidar?: boolean;
}
export interface PeerCouchDBConf extends DirectFileManipulatorOptions {
type: "couchdb";
useRemoteTweaks?: true;
group?: string;
name: string;
database: string;
username: string;
password: string;
url: string;
customChunkSize?: number;
minimumChunkSize?: number;
passphrase: string;
obfuscatePassphrase: string;
baseDir: string;
}
export function isCouchDBPeer(peer: PeerConf): peer is PeerCouchDBConf {
return peer.type == "couchdb";
}
export function isStoragePeer(peer: PeerConf): peer is PeerStorageConf {
return peer.type == "storage";
}
export type FileData = {
ctime: number;
mtime: number;
size: number;
data: string[] | Uint8Array
deleted?: boolean;
}