flipper-common
Version:
Server & UI shared Flipper utilities
235 lines • 6.93 kB
TypeScript
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
export declare namespace FlipperDoctor {
type EnvironmentInfo = {
SDKs: {
'iOS SDK': {
Platforms: string[];
};
'Android SDK': {
'API Levels': string[] | 'Not Found';
'Build Tools': string[] | 'Not Found';
'System Images': string[] | 'Not Found';
'Android NDK': string | 'Not Found';
} | 'Not Found';
};
IDEs: {
Xcode: {
version: string;
path: string;
};
};
};
type HealthcheckCategory = {
label: string;
isSkipped: false;
isRequired: boolean;
healthchecks: Healthcheck[];
};
type SkippedHealthcheckCategory = {
label: string;
isSkipped: true;
skipReason: string;
};
type Healthchecks = {
common: HealthcheckCategory | SkippedHealthcheckCategory;
android: HealthcheckCategory | SkippedHealthcheckCategory;
ios: HealthcheckCategory | SkippedHealthcheckCategory;
};
type Settings = {
idbPath: string;
enablePhysicalIOS: boolean;
};
type Healthcheck = {
key: string;
label: string;
isRequired?: boolean;
run?: (env: EnvironmentInfo, settings?: Settings) => Promise<HealthcheckRunResult>;
};
type CliCommand = {
title: string;
command: string;
};
type HealthcheckRunSubcheck = {
status: 'ok' | 'fail';
title: string;
};
type HealthcheckRunResult = {
hasProblem: boolean;
/** Indicates what sub checks were passed to better communicate the problem */
subchecks?: HealthcheckRunSubcheck[];
message: MessageIdWithParams;
};
type SubprocessHealtcheckRunResult = (HealthcheckRunResult & {
hasProblem: true;
}) | (HealthcheckRunResult & {
hasProblem: false;
stdout: string;
});
type CategoryResult = [
string,
{
label: string;
results: Array<{
key: string;
label: string;
isRequired: boolean;
result: {
hasProblem: boolean;
};
}>;
}
];
type Dictionary<T> = {
[key: string]: T;
};
type HealthcheckStatus = 'IN_PROGRESS' | 'SUCCESS' | 'FAILED' | 'SKIPPED' | 'WARNING';
type HealthcheckResult = {
status: HealthcheckStatus;
isAcknowledged?: boolean;
message?: MessageIdWithParams;
subchecks?: HealthcheckRunSubcheck[];
};
type HealthcheckReportItem = {
key: string;
label: string;
result: HealthcheckResult;
};
type HealthcheckReportCategory = {
key: string;
label: string;
result: HealthcheckResult;
checks: Dictionary<HealthcheckReportItem>;
};
type HealthcheckReport = {
result: HealthcheckResult;
categories: Dictionary<HealthcheckReportCategory>;
};
type HealthcheckSettings = {
settings: {
enableAndroid: boolean;
enableIOS: boolean;
enablePhysicalIOS: boolean;
idbPath: string;
};
isProduction: boolean;
};
/**
* key - message id
* value - params of message function
*/
type HealthcheckResultMessageMapping = {
'common.openssl--installed': [{
output: string;
}];
'common.openssl--not_installed': [{
output: string;
}];
'common.watchman--installed': [];
'common.watchman--not_installed': [];
'android.android-studio--installed': [];
'android.android-studio--not_installed': [{
platform: string;
}];
'android.sdk--no_ANDROID_HOME': [];
'android.sdk--invalid_ANDROID_HOME': [
{
androidHome: string;
existingAndroidHome: string | null;
}
];
'android.sdk--no_android_sdk': [{
platformToolsDir: string;
}];
'android.sdk--no_ANDROID_SDK_ROOT': [];
'android.sdk--unexisting_folder_ANDROID_SDK_ROOT': [];
'android.sdk--installed': [{
output: string;
}];
'android.sdk--not_installed': [{
output: string;
}];
'ios.xcode--installed': [{
version: string;
path: string;
}];
'ios.xcode--not_installed': [];
'ios.xcode-select--set': [{
selected: string;
}];
'ios.xcode-select--not_set': [
{
message: string;
availableXcode: string | null;
}
];
'ios.xcode-select--no_xcode_selected': [{
availableXcode: string | null;
}];
'ios.xcode-select--noop': [];
'ios.xcode-select--custom_path': [
{
selectedPath: string;
availableXcode: string | null;
}
];
'ios.xcode-select--old_version_selected': [
{
selectedVersion: string;
latestXCode: string;
}
];
'ios.xcode-select--nonexisting_selected': [
{
selected: string;
availableXcode: string | null;
}
];
'ios.sdk--installed': [{
platforms: string[];
}];
'ios.sdk--not_installed': [];
'ios.has-simulators--idb-failed': [{
message: string;
}];
'ios.has-simulators--no-devices': [];
'ios.has-simulators--ok': [{
count: number;
}];
'ios.xctrace--installed': [{
output: string;
}];
'ios.xctrace--not_installed': [{
message: string;
}];
'ios.idb--no_context': [];
'ios.idb--physical_device_disabled': [];
'ios.idb--not_installed_but_present': [
{
idbPath: string;
idbInPath: string;
}
];
'ios.idb--not_installed': [{
idbPath: string;
hasIdbCompanion: boolean;
}];
'ios.idb--installed': [];
'doctor-failed': [{
error: any;
}];
skipped: [{
reason: string;
}];
};
type MessageIdWithParams = {
[K in keyof HealthcheckResultMessageMapping]: HealthcheckResultMessageMapping[K][0] extends void ? [K] : [K, ...HealthcheckResultMessageMapping[K]];
}[keyof HealthcheckResultMessageMapping];
}
//# sourceMappingURL=doctor.d.ts.map