Databases plugin migrated to Sandy functional API
Summary: Converted Databases plugin to Sandy functional API Reviewed By: mweststrate Differential Revision: D27999205 fbshipit-source-id: e9d2c7aa5858b9da3c1672efbb558fb6b1077b6b
This commit is contained in:
committed by
Facebook GitHub Bot
parent
140cf38ffd
commit
c2a07e7638
@@ -7,9 +7,7 @@
|
|||||||
* @format
|
* @format
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {PluginClient, Value} from 'flipper';
|
import {Value} from 'flipper';
|
||||||
|
|
||||||
type ClientCall<Params, Response> = (arg: Params) => Promise<Response>;
|
|
||||||
|
|
||||||
type DatabaseListRequest = {};
|
type DatabaseListRequest = {};
|
||||||
|
|
||||||
@@ -71,28 +69,14 @@ type GetTableInfoResponse = {
|
|||||||
definition: string;
|
definition: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export class DatabaseClient {
|
export type Methods = {
|
||||||
client: PluginClient;
|
databaseList(params: DatabaseListRequest): Promise<DatabaseListResponse>;
|
||||||
|
getTableData(params: QueryTableRequest): Promise<QueryTableResponse>;
|
||||||
|
getTableStructure(
|
||||||
|
params: GetTableStructureRequest,
|
||||||
|
): Promise<GetTableStructureResponse>;
|
||||||
|
execute(params: ExecuteSqlRequest): Promise<ExecuteSqlResponse>;
|
||||||
|
getTableInfo(params: GetTableInfoRequest): Promise<GetTableInfoResponse>;
|
||||||
|
};
|
||||||
|
|
||||||
constructor(pluginClient: PluginClient) {
|
export type Events = {};
|
||||||
this.client = pluginClient;
|
|
||||||
}
|
|
||||||
|
|
||||||
getDatabases: ClientCall<DatabaseListRequest, DatabaseListResponse> = () =>
|
|
||||||
this.client.call('databaseList', {});
|
|
||||||
|
|
||||||
getTableData: ClientCall<QueryTableRequest, QueryTableResponse> = (params) =>
|
|
||||||
this.client.call('getTableData', params);
|
|
||||||
|
|
||||||
getTableStructure: ClientCall<
|
|
||||||
GetTableStructureRequest,
|
|
||||||
GetTableStructureResponse
|
|
||||||
> = (params) => this.client.call('getTableStructure', params);
|
|
||||||
|
|
||||||
getExecution: ClientCall<ExecuteSqlRequest, ExecuteSqlResponse> = (params) =>
|
|
||||||
this.client.call('execute', params);
|
|
||||||
|
|
||||||
getTableInfo: ClientCall<GetTableInfoRequest, GetTableInfoResponse> = (
|
|
||||||
params,
|
|
||||||
) => this.client.call('getTableInfo', params);
|
|
||||||
}
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -22,6 +22,9 @@
|
|||||||
"react-redux": "^7.2.3",
|
"react-redux": "^7.2.3",
|
||||||
"redux-mock-store": "^1.0.1"
|
"redux-mock-store": "^1.0.1"
|
||||||
},
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"flipper-plugin": "*"
|
||||||
|
},
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"email": "oncall+flipper@xmail.facebook.com",
|
"email": "oncall+flipper@xmail.facebook.com",
|
||||||
"url": "https://fb.workplace.com/groups/flippersupport/"
|
"url": "https://fb.workplace.com/groups/flippersupport/"
|
||||||
|
|||||||
Reference in New Issue
Block a user