forked from tdeekens/flopflip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
54 lines (53 loc) · 1.49 KB
/
index.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
export type FlagName = string;
export type FlagVariation = boolean | string;
export type Flag = [FlagName, FlagVariation];
export type Flags = { [key: string]: FlagVariation };
export type User = {
key?: string;
};
export type AdapterArgs = {
user: User;
adapterConfiguration: {
pollingInteral: number;
};
onFlagsStateChange(flags: Flags): void;
onStatusStateChange(status: AdapterStatus): void;
};
export type AdapterStatus = {
isReady?: boolean;
isConfigured?: boolean;
};
export type Adapter = {
configure(adapterArgs: AdapterArgs): Promise<any>;
reconfigure(adapterArgs: AdapterArgs): Promise<any>;
getIsReady(): boolean;
};
export type AdapterStatusChange = { [key: string]: boolean };
export type OnFlagsStateChangeCallback = (flags: Flags) => void;
export type OnStatusStateChangeCallback = (
statusChange: AdapterStatusChange
) => void;
export type AdapterReconfigurationOptions = {
shouldOverwrite?: boolean;
};
export type AdapterReconfiguration = {
adapterArgs: AdapterArgs;
options: AdapterReconfigurationOptions;
};
export type ConfigureAdapterChildren = ({
isAdapterReady,
}: {
isAdapterReady: boolean;
}) => React.ReactNode | React.ReactNode | null;
export type ReconfigureAdapter = (
adapterArgs: AdapterArgs,
options: AdapterReconfigurationOptions
) => void;
export type AdapterContext = {
reconfigure: ReconfigureAdapter;
status: AdapterStatus;
};
export type Diff<ExcludedFrom, ToExclude> = Pick<
ExcludedFrom,
Exclude<keyof ExcludedFrom, keyof ToExclude>
>;