-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.d.ts
62 lines (49 loc) · 1.17 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
57
58
59
60
61
62
interface IntervalRetrierOptions {
times: number;
interval: number;
}
interface TimeoutRetrierOptions {
interval: number;
timeout: number;
}
interface ValidateFixedTimesRetrierOptionsParameter {
times: number;
interval?: number;
}
interface ValidateTimeoutRetrierOptionsParameter {
timeout: number;
interval?: number;
}
type RetrierOptions = IntervalRetrierOptions | TimeoutRetrierOptions;
type CallbackHandler = (...args) => unknown;
interface Handlers {
onSuccess?: CallbackHandler;
onFailure?: CallbackHandler;
}
type HeaderAuthHandler = () => Promise<string>;
type AllowedAuthHanders = HeaderAuthHandler;
interface EnabledAuthOptions {
type: string;
fn: AllowedAuthHanders;
}
type RawAuthOptions = EnabledAuthOptions | boolean;
interface ValidAuthOptions {
enabled: boolean;
type?: string;
fn?: AllowedAuthHanders;
}
interface ClientOptions {
url?: string;
auth?: RawAuthOptions;
retry?: RetrierOptions;
}
interface ValidatedClientOptions {
url: string;
auth: ValidAuthOptions;
retry: RetrierOptions;
}
interface Client {
// TODO add more typing to query
// eslint-disable-next-line @typescript-eslint/ban-types
query: Function;
}