Serialize Store

Summary:
This diff adds the capability to export the flipper data to a file. With this diff you can click on the "Export Flipper" option from the "Edit" menu in menubar. It will export it in the file at this location

`~/.flipper/MessageLogs.json`

We do not exactly export the store, but just the important part of it. We export in the following format

```
{
fileVersion: '1.0',
device: {
   os: 'iOS',
   title: 'iPhone 7',
   serial: '',
   deviceType: 'physical',
  },
clients: [
   {
    query: {
       app: 'Facebook',
      },
      d: '12345678'
     },
   {
    query: {
       app: 'Instagram',
      },
    id: '12345678'
   }
],
store: {
   pluginState: {},
   notifications: {}
  }
}

```

In next diff I will add the capability to select the folder to export the file too.

Reviewed By: danielbuechele

Differential Revision: D13751963

fbshipit-source-id: 7d3d49c6adf8145b2181d2332c7dbd589155cec3
This commit is contained in:
Pritesh Nandgaonkar
2019-01-28 15:33:56 -08:00
committed by Facebook Github Bot
parent fc1d32a3f9
commit 5ef970e5b5
7 changed files with 118 additions and 11 deletions

View File

@@ -73,7 +73,6 @@ export default class Client extends EventEmitter {
store: Store,
) {
super();
this.connected = true;
this.plugins = [];
this.connection = conn;
@@ -104,6 +103,7 @@ export default class Client extends EventEmitter {
},
});
}
getDevice = (): ?BaseDevice =>
this.store
.getState()
@@ -272,7 +272,7 @@ export default class Client extends EventEmitter {
}
toJSON() {
return `<Client#${this.id}>`;
return {id: this.id, query: this.query};
}
subscribe(