appium-remote-debugger 15.7.2 → 15.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/build/lib/atoms.d.ts.map +1 -1
- package/build/lib/atoms.js +27 -28
- package/build/lib/atoms.js.map +1 -1
- package/build/lib/index.d.ts.map +1 -1
- package/build/lib/index.js +7 -0
- package/build/lib/index.js.map +1 -1
- package/build/lib/mixins/connect.d.ts.map +1 -1
- package/build/lib/mixins/connect.js +21 -25
- package/build/lib/mixins/connect.js.map +1 -1
- package/build/lib/mixins/execute.d.ts.map +1 -1
- package/build/lib/mixins/execute.js +2 -8
- package/build/lib/mixins/execute.js.map +1 -1
- package/build/lib/mixins/message-handlers.d.ts.map +1 -1
- package/build/lib/mixins/message-handlers.js +8 -12
- package/build/lib/mixins/message-handlers.js.map +1 -1
- package/build/lib/mixins/misc.d.ts.map +1 -1
- package/build/lib/mixins/misc.js +5 -39
- package/build/lib/mixins/misc.js.map +1 -1
- package/build/lib/mixins/navigate.d.ts.map +1 -1
- package/build/lib/mixins/navigate.js +20 -55
- package/build/lib/mixins/navigate.js.map +1 -1
- package/build/lib/mixins/property-accessors.d.ts +24 -0
- package/build/lib/mixins/property-accessors.d.ts.map +1 -1
- package/build/lib/mixins/property-accessors.js +24 -0
- package/build/lib/mixins/property-accessors.js.map +1 -1
- package/build/lib/remote-debugger.d.ts +38 -38
- package/build/lib/remote-debugger.d.ts.map +1 -1
- package/build/lib/remote-debugger.js +64 -69
- package/build/lib/remote-debugger.js.map +1 -1
- package/build/lib/rpc/remote-messages.d.ts.map +1 -1
- package/build/lib/rpc/remote-messages.js +7 -8
- package/build/lib/rpc/remote-messages.js.map +1 -1
- package/build/lib/rpc/rpc-client-real-device-shim.d.ts.map +1 -1
- package/build/lib/rpc/rpc-client-real-device-shim.js +3 -6
- package/build/lib/rpc/rpc-client-real-device-shim.js.map +1 -1
- package/build/lib/rpc/rpc-client-simulator.d.ts.map +1 -1
- package/build/lib/rpc/rpc-client-simulator.js +3 -5
- package/build/lib/rpc/rpc-client-simulator.js.map +1 -1
- package/build/lib/rpc/rpc-client.d.ts +27 -27
- package/build/lib/rpc/rpc-client.d.ts.map +1 -1
- package/build/lib/rpc/rpc-client.js +226 -224
- package/build/lib/rpc/rpc-client.js.map +1 -1
- package/build/lib/rpc/rpc-message-handler.js +7 -10
- package/build/lib/rpc/rpc-message-handler.js.map +1 -1
- package/build/lib/types.d.ts +19 -19
- package/build/lib/types.d.ts.map +1 -1
- package/build/lib/utils.d.ts +70 -4
- package/build/lib/utils.d.ts.map +1 -1
- package/build/lib/utils.js +171 -23
- package/build/lib/utils.js.map +1 -1
- package/lib/atoms.ts +31 -32
- package/lib/index.ts +7 -0
- package/lib/mixins/connect.ts +22 -23
- package/lib/mixins/execute.ts +3 -5
- package/lib/mixins/message-handlers.ts +9 -10
- package/lib/mixins/misc.ts +8 -7
- package/lib/mixins/navigate.ts +58 -63
- package/lib/mixins/property-accessors.ts +24 -0
- package/lib/remote-debugger.ts +74 -76
- package/lib/rpc/remote-messages.ts +10 -5
- package/lib/rpc/rpc-client-real-device-shim.ts +3 -3
- package/lib/rpc/rpc-client-simulator.ts +3 -5
- package/lib/rpc/rpc-client.ts +259 -247
- package/lib/rpc/rpc-message-handler.ts +7 -7
- package/lib/types.ts +24 -24
- package/lib/utils.ts +181 -23
- package/package.json +4 -8
- package/scripts/common.mjs +42 -37
- package/scripts/web_inspector_proxy.mjs +3 -5
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _ from 'lodash';
|
|
2
1
|
import {getProtocolCommand} from '../protocol';
|
|
3
2
|
import type {
|
|
4
3
|
RawRemoteCommand,
|
|
@@ -15,6 +14,12 @@ const MINIMAL_COMMAND = 'getMinimalCommand';
|
|
|
15
14
|
const FULL_COMMAND = 'getFullCommand';
|
|
16
15
|
const DIRECT_COMMAND = 'getDirectCommand';
|
|
17
16
|
|
|
17
|
+
function omitNilValues<T extends Record<string, any>>(obj: T): Partial<T> {
|
|
18
|
+
return Object.fromEntries(
|
|
19
|
+
Object.entries(obj).filter(([, value]) => value !== null && value !== undefined),
|
|
20
|
+
) as Partial<T>;
|
|
21
|
+
}
|
|
22
|
+
|
|
18
23
|
// mapping of commands to the function for getting the command
|
|
19
24
|
// defaults to `getMinimalCommand`, so no need to have those listed here
|
|
20
25
|
const COMMANDS = {
|
|
@@ -117,7 +122,7 @@ export class RemoteMessages {
|
|
|
117
122
|
return {
|
|
118
123
|
__argument: {
|
|
119
124
|
WIRApplicationIdentifierKey: appIdKey,
|
|
120
|
-
WIRIndicateEnabledKey:
|
|
125
|
+
WIRIndicateEnabledKey: enabled == null ? true : enabled,
|
|
121
126
|
WIRConnectionIdentifierKey: connId,
|
|
122
127
|
WIRPageIdentifierKey: pageIdKey,
|
|
123
128
|
},
|
|
@@ -191,7 +196,7 @@ export class RemoteMessages {
|
|
|
191
196
|
},
|
|
192
197
|
__selector: '_rpc_forwardSocketData:',
|
|
193
198
|
};
|
|
194
|
-
return
|
|
199
|
+
return omitNilValues(plist) as RawRemoteCommand;
|
|
195
200
|
}
|
|
196
201
|
|
|
197
202
|
/**
|
|
@@ -227,7 +232,7 @@ export class RemoteMessages {
|
|
|
227
232
|
},
|
|
228
233
|
__selector: '_rpc_forwardSocketData:',
|
|
229
234
|
};
|
|
230
|
-
return
|
|
235
|
+
return omitNilValues(plist) as RawRemoteCommand;
|
|
231
236
|
}
|
|
232
237
|
|
|
233
238
|
/**
|
|
@@ -254,7 +259,7 @@ export class RemoteMessages {
|
|
|
254
259
|
},
|
|
255
260
|
__selector: '_rpc_forwardSocketData:',
|
|
256
261
|
};
|
|
257
|
-
return
|
|
262
|
+
return omitNilValues(plist) as RawRemoteCommand;
|
|
258
263
|
}
|
|
259
264
|
|
|
260
265
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {log} from '../logger';
|
|
2
|
+
import {isPlainObject} from '../utils';
|
|
2
3
|
import {RpcClient} from './rpc-client';
|
|
3
4
|
import type {RemoteCommand, RpcClientOptions} from '../types';
|
|
4
5
|
import type {StringRecord} from '@appium/types';
|
|
5
6
|
import type {WebInspectorService, RemoteXpcConnection} from 'appium-ios-remotexpc';
|
|
6
|
-
import _ from 'lodash';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Options specific to RpcClientRealDeviceShim.
|
|
@@ -190,7 +190,7 @@ export class RpcClientRealDeviceShim extends RpcClient {
|
|
|
190
190
|
};
|
|
191
191
|
|
|
192
192
|
// Convert buffer data to strings where necessary
|
|
193
|
-
if (
|
|
193
|
+
if (isPlainObject(message.__argument)) {
|
|
194
194
|
const args = {...message.__argument};
|
|
195
195
|
|
|
196
196
|
// Handle WIRMessageDataKey and WIRSocketDataKey which may be buffers
|
|
@@ -213,7 +213,7 @@ export class RpcClientRealDeviceShim extends RpcClient {
|
|
|
213
213
|
* @returns The translated arguments for the shim service.
|
|
214
214
|
*/
|
|
215
215
|
private translateArguments(args: any): StringRecord {
|
|
216
|
-
if (!
|
|
216
|
+
if (!isPlainObject(args)) {
|
|
217
217
|
return {};
|
|
218
218
|
}
|
|
219
219
|
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import {log} from '../logger';
|
|
2
|
-
import _ from 'lodash';
|
|
3
|
-
import B from 'bluebird';
|
|
4
2
|
import net from 'node:net';
|
|
5
3
|
import {RpcClient} from './rpc-client';
|
|
6
4
|
import {services} from 'appium-ios-device';
|
|
@@ -110,7 +108,7 @@ export class RpcClientSimulator extends RpcClient {
|
|
|
110
108
|
this.service.listenMessage(this.receive.bind(this));
|
|
111
109
|
|
|
112
110
|
// connect the socket
|
|
113
|
-
return await new
|
|
111
|
+
return await new Promise<void>((resolve, reject) => {
|
|
114
112
|
// only resolve this function when we are actually connected
|
|
115
113
|
if (!this.socket) {
|
|
116
114
|
return reject(new Error('RPC socket is not connected. Please contact developers'));
|
|
@@ -157,7 +155,7 @@ export class RpcClientSimulator extends RpcClient {
|
|
|
157
155
|
override async sendMessage(cmd: RemoteCommand): Promise<void> {
|
|
158
156
|
let onSocketError: ((err: Error) => void) | undefined;
|
|
159
157
|
|
|
160
|
-
return await new
|
|
158
|
+
return await new Promise<void>((resolve, reject) => {
|
|
161
159
|
// handle socket problems
|
|
162
160
|
onSocketError = (err: Error) => {
|
|
163
161
|
log.error(`Socket error: ${err.message}`);
|
|
@@ -196,7 +194,7 @@ export class RpcClientSimulator extends RpcClient {
|
|
|
196
194
|
}
|
|
197
195
|
|
|
198
196
|
for (const key of ['WIRMessageDataKey', 'WIRDestinationKey', 'WIRSocketDataKey']) {
|
|
199
|
-
if (
|
|
197
|
+
if (data[key] !== undefined) {
|
|
200
198
|
data[key] = data[key].toString('utf8');
|
|
201
199
|
}
|
|
202
200
|
}
|