Extend Flipper commands to support server add-on messaging

Reviewed By: mweststrate

Differential Revision: D34046466

fbshipit-source-id: 9acc172c1805ec724b8709999bacf9e899c39e6b
This commit is contained in:
Andrey Goncharov
2022-02-28 03:50:34 -08:00
committed by Facebook GitHub Bot
parent 3b390b74ff
commit 12151e4a71
4 changed files with 44 additions and 0 deletions

View File

@@ -424,6 +424,22 @@ export class FlipperServerImpl implements FlipperServer {
// TODO: Figure out if it needs to be async
'plugins-server-add-on-stop': async (pluginName, owner) =>
this.pluginManager.stopServerAddOn(pluginName, owner),
'plugins-server-add-on-request-response': async (payload) => {
const serverAddOn = this.pluginManager.getServerAddOnForMessage(payload);
if (serverAddOn) {
return await serverAddOn.connection.sendExpectResponse(payload);
}
return {
length: 0,
error: {
message: `Server add-on for message '${JSON.stringify(
payload,
)} is no longer running.`,
name: 'SERVER_ADDON_STOPPED',
stacktrace: '',
},
};
},
'doctor-get-healthchecks': getHealthChecks,
'doctor-run-healthcheck': runHealthcheck,
'open-file': openFile,