appium-remote-debugger 15.2.13 → 15.2.14

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 CHANGED
@@ -1,3 +1,9 @@
1
+ ## [15.2.14](https://github.com/appium/appium-remote-debugger/compare/v15.2.13...v15.2.14) (2026-01-24)
2
+
3
+ ### Miscellaneous Chores
4
+
5
+ * Migrate RPC helpers to typescript ([#471](https://github.com/appium/appium-remote-debugger/issues/471)) ([8da661f](https://github.com/appium/appium-remote-debugger/commit/8da661fe6554b5d7b862408fd24d1ce40873f30c))
6
+
1
7
  ## [15.2.13](https://github.com/appium/appium-remote-debugger/compare/v15.2.12...v15.2.13) (2026-01-22)
2
8
 
3
9
  ### Miscellaneous Chores
@@ -1,12 +1,17 @@
1
+ import type { RemoteCommandOpts, ProtocolCommandOpts } from '../types';
1
2
  /**
3
+ * Generates a protocol command object based on the command name and options.
4
+ * Extracts only the parameters that are defined for the specific command in the
5
+ * WebKit Inspector protocol specification.
2
6
  *
3
- * @param {string} id
4
- * @param {string} method
5
- * @param {import('../types').RemoteCommandOpts} opts
6
- * @param {boolean} [direct=false] - if set to false then the resulting command params
7
- * will be patched with default values
8
- * @returns {import('../types').ProtocolCommandOpts}
7
+ * @param id - The command identifier.
8
+ * @param method - The protocol method name (e.g., 'Page.navigate', 'Runtime.evaluate').
9
+ * @param opts - Options containing parameters for the command.
10
+ * @param direct - If false (default), the resulting command params will be patched
11
+ * with default values (objectGroup, includeCommandLineAPI, etc.).
12
+ * If true, only the specified parameters are included.
13
+ * @returns A ProtocolCommandOpts object with id, method, and params.
14
+ * @throws Error if the command method is unknown.
9
15
  */
10
- export function getProtocolCommand(id: string, method: string, opts: import("../types").RemoteCommandOpts, direct?: boolean): import("../types").ProtocolCommandOpts;
11
- export default getProtocolCommand;
16
+ export declare function getProtocolCommand(id: string, method: string, opts: RemoteCommandOpts, direct?: boolean): ProtocolCommandOpts;
12
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/protocol/index.js"],"names":[],"mappings":"AAwMA;;;;;;;;GAQG;AACH,uCAPW,MAAM,UACN,MAAM,QACN,OAAO,UAAU,EAAE,iBAAiB,WACpC,OAAO,GAEL,OAAO,UAAU,EAAE,mBAAmB,CA6BlD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/protocol/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AA0MvE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAChC,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,iBAAiB,EACvB,MAAM,GAAE,OAAe,GACtB,mBAAmB,CA4BrB"}
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getProtocolCommand = getProtocolCommand;
4
4
  const OBJECT_GROUP = 'console';
5
5
  // See https://github.com/WebKit/webkit/tree/master/Source/JavaScriptCore/inspector/protocol
6
- const COMMANDS = /** @type {const} */ ({
6
+ const COMMANDS = {
7
7
  // https://github.com/WebKit/WebKit/blob/main/Source/JavaScriptCore/inspector/protocol/Animation.json
8
8
  //#region ANIMATION DOMAIN
9
9
  'Animation.enable': [], // Enables Canvas domain events
@@ -171,24 +171,30 @@ const COMMANDS = /** @type {const} */ ({
171
171
  'Worker.initialized': ['workerId'],
172
172
  'Worker.sendMessageToWorker': ['workerId', 'message']
173
173
  //#endregion
174
- });
174
+ };
175
175
  /**
176
+ * Generates a protocol command object based on the command name and options.
177
+ * Extracts only the parameters that are defined for the specific command in the
178
+ * WebKit Inspector protocol specification.
176
179
  *
177
- * @param {string} id
178
- * @param {string} method
179
- * @param {import('../types').RemoteCommandOpts} opts
180
- * @param {boolean} [direct=false] - if set to false then the resulting command params
181
- * will be patched with default values
182
- * @returns {import('../types').ProtocolCommandOpts}
180
+ * @param id - The command identifier.
181
+ * @param method - The protocol method name (e.g., 'Page.navigate', 'Runtime.evaluate').
182
+ * @param opts - Options containing parameters for the command.
183
+ * @param direct - If false (default), the resulting command params will be patched
184
+ * with default values (objectGroup, includeCommandLineAPI, etc.).
185
+ * If true, only the specified parameters are included.
186
+ * @returns A ProtocolCommandOpts object with id, method, and params.
187
+ * @throws Error if the command method is unknown.
183
188
  */
184
189
  function getProtocolCommand(id, method, opts, direct = false) {
185
190
  const paramNames = COMMANDS[method];
186
191
  if (!paramNames) {
187
192
  throw new Error(`Unknown command: '${method}'`);
188
193
  }
189
- const params = paramNames.reduce(function (params, name) {
190
- params[name] = opts[name];
191
- return params;
194
+ const params = paramNames
195
+ .reduce(function (acc, name) {
196
+ acc[name] = opts[name];
197
+ return acc;
192
198
  }, {});
193
199
  const result = {
194
200
  id,
@@ -208,5 +214,4 @@ function getProtocolCommand(id, method, opts, direct = false) {
208
214
  }
209
215
  return result;
210
216
  }
211
- exports.default = getProtocolCommand;
212
217
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/protocol/index.js"],"names":[],"mappings":";;AAiNA,gDA2BC;AA5OD,MAAM,YAAY,GAAG,SAAS,CAAC;AAE/B,4FAA4F;AAC5F,MAAM,QAAQ,GAAG,oBAAoB,CAAC,CAAC;IACrC,qGAAqG;IACrG,0BAA0B;IAC1B,kBAAkB,EAAE,EAAE,EAAE,+BAA+B;IACvD,mBAAmB,EAAE,EAAE,EAAE,gCAAgC;IACzD,YAAY;IAEZ,4GAA4G;IAC5G,iCAAiC;IACjC,yBAAyB,EAAE,EAAE;IAC7B,0BAA0B,EAAE,EAAE;IAC9B,yCAAyC,EAAE,EAAE;IAC7C,YAAY;IAEZ,iGAAiG;IACjG,sBAAsB;IACtB,YAAY;IAEZ,mGAAmG;IACnG,wBAAwB;IACxB,gBAAgB,EAAE,EAAE,EAAE,wDAAw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C;IACzB,MAAM,MAAM,GAAwB;QAClC,EAAE;QACF,MAAM;QACN,MAAM;KACP,CAAC;IACF,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,CAAC,MAAM,GAAG;YACd,WAAW,EAAE,YAAY;YACzB,qBAAqB,EAAE,IAAI;YAC3B,oCAAoC,EAAE,KAAK;YAC3C,kBAAkB,EAAE,KAAK;YACzB,eAAe,EAAE,KAAK;YACtB,UAAU,EAAE,KAAK;YACjB,GAAG,MAAM,CAAC,MAAM;SACjB,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1,4 +1,3 @@
1
- import { RpcClientSimulator } from './rpc-client-simulator';
2
- import { RpcClientRealDevice } from './rpc-client-real-device';
3
- export { RpcClientSimulator, RpcClientRealDevice };
1
+ export { RpcClientSimulator } from './rpc-client-simulator';
2
+ export { RpcClientRealDevice } from './rpc-client-real-device';
4
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/rpc/index.js"],"names":[],"mappings":"mCAAmC,wBAAwB;oCACvB,0BAA0B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/rpc/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC"}
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RpcClientRealDevice = exports.RpcClientSimulator = void 0;
4
- const rpc_client_simulator_1 = require("./rpc-client-simulator");
4
+ var rpc_client_simulator_1 = require("./rpc-client-simulator");
5
5
  Object.defineProperty(exports, "RpcClientSimulator", { enumerable: true, get: function () { return rpc_client_simulator_1.RpcClientSimulator; } });
6
- const rpc_client_real_device_1 = require("./rpc-client-real-device");
6
+ var rpc_client_real_device_1 = require("./rpc-client-real-device");
7
7
  Object.defineProperty(exports, "RpcClientRealDevice", { enumerable: true, get: function () { return rpc_client_real_device_1.RpcClientRealDevice; } });
8
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/rpc/index.js"],"names":[],"mappings":";;;AAAA,iEAA4D;AAGnD,mGAHA,yCAAkB,OAGA;AAF3B,qEAA+D;AAElC,oGAFpB,4CAAmB,OAEoB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/rpc/index.ts"],"names":[],"mappings":";;;AAAA,+DAA4D;AAAnD,0HAAA,kBAAkB,OAAA;AAC3B,mEAA+D;AAAtD,6HAAA,mBAAmB,OAAA"}
@@ -1,72 +1,93 @@
1
+ import type { RawRemoteCommand, RemoteCommandOpts, ProtocolCommandOpts, AppIdKey, PageIdKey, RemoteCommandId } from '../types';
1
2
  /**
2
- *
3
- * @param {string} command
4
- * @returns {boolean}
3
+ * Generates remote commands for communicating with the Web Inspector.
4
+ * Provides methods for creating various types of commands including connection
5
+ * setup, application management, and protocol commands.
5
6
  */
6
- export function isDirectCommand(command: string): boolean;
7
- export class RemoteMessages {
7
+ export declare class RemoteMessages {
8
8
  /**
9
+ * Creates a command to set the connection key for the Web Inspector session.
9
10
  *
10
- * @param {string} connId
11
- * @returns {import('../types').RawRemoteCommand}
11
+ * @param connId - The connection identifier.
12
+ * @returns A RawRemoteCommand for setting the connection key.
12
13
  */
13
- setConnectionKey(connId: string): import("../types").RawRemoteCommand;
14
+ setConnectionKey(connId: string): RawRemoteCommand;
14
15
  /**
16
+ * Creates a command to connect to a specific application.
15
17
  *
16
- * @param {string} connId
17
- * @param {import('../types').AppIdKey} appIdKey
18
- * @returns {import('../types').RawRemoteCommand}
18
+ * @param connId - The connection identifier.
19
+ * @param appIdKey - The application identifier key.
20
+ * @returns A RawRemoteCommand for connecting to the application.
19
21
  */
20
- connectToApp(connId: string, appIdKey: import("../types").AppIdKey): import("../types").RawRemoteCommand;
22
+ connectToApp(connId: string, appIdKey: AppIdKey): RawRemoteCommand;
21
23
  /**
24
+ * Creates a command to set the sender key for message routing.
22
25
  *
23
- * @param {string} connId
24
- * @param {string} senderId
25
- * @param {import('../types').AppIdKey} appIdKey
26
- * @param {import('../types').PageIdKey} [pageIdKey]
27
- * @returns {import('../types').RawRemoteCommand}
26
+ * @param connId - The connection identifier.
27
+ * @param senderId - The sender identifier.
28
+ * @param appIdKey - The application identifier key.
29
+ * @param pageIdKey - Optional page identifier key.
30
+ * @returns A RawRemoteCommand for setting the sender key.
28
31
  */
29
- setSenderKey(connId: string, senderId: string, appIdKey: import("../types").AppIdKey, pageIdKey?: import("../types").PageIdKey): import("../types").RawRemoteCommand;
32
+ setSenderKey(connId: string, senderId: string, appIdKey: AppIdKey, pageIdKey?: PageIdKey): RawRemoteCommand;
30
33
  /**
34
+ * Creates a command to indicate web view status.
31
35
  *
32
- * @param {string} connId
33
- * @param {import('../types').AppIdKey} appIdKey
34
- * @param {import('../types').PageIdKey} [pageIdKey]
35
- * @param {boolean} [enabled]
36
- * @returns {import('../types').RawRemoteCommand}
36
+ * @param connId - The connection identifier.
37
+ * @param appIdKey - The application identifier key.
38
+ * @param pageIdKey - Optional page identifier key.
39
+ * @param enabled - Whether the web view indication is enabled. Defaults to true if not provided.
40
+ * @returns A RawRemoteCommand for indicating web view status.
37
41
  */
38
- indicateWebView(connId: string, appIdKey: import("../types").AppIdKey, pageIdKey?: import("../types").PageIdKey, enabled?: boolean): import("../types").RawRemoteCommand;
42
+ indicateWebView(connId: string, appIdKey: AppIdKey, pageIdKey?: PageIdKey, enabled?: boolean): RawRemoteCommand;
39
43
  /**
44
+ * Creates a command to launch an application.
40
45
  *
41
- * @param {string} bundleId
42
- * @returns {import('../types').RawRemoteCommand}
46
+ * @param bundleId - The bundle identifier of the application to launch.
47
+ * @returns A RawRemoteCommand for launching the application.
43
48
  */
44
- launchApplication(bundleId: string): import("../types").RawRemoteCommand;
49
+ launchApplication(bundleId: string): RawRemoteCommand;
45
50
  /**
51
+ * Creates a full command with all default parameters included.
52
+ * This includes objectGroup, includeCommandLineAPI, and other runtime options.
46
53
  *
47
- * @param {import('../types').RemoteCommandOpts & import('../types').ProtocolCommandOpts} opts
48
- * @returns {import('../types').RawRemoteCommand}
54
+ * @param opts - Options combining RemoteCommandOpts and ProtocolCommandOpts.
55
+ * @returns A RawRemoteCommand with full parameter set.
49
56
  */
50
- getFullCommand(opts: import("../types").RemoteCommandOpts & import("../types").ProtocolCommandOpts): import("../types").RawRemoteCommand;
57
+ getFullCommand(opts: RemoteCommandOpts & ProtocolCommandOpts): RawRemoteCommand;
51
58
  /**
59
+ * Creates a minimal command with only the essential parameters.
60
+ * This is the default command type for most operations.
52
61
  *
53
- * @param {import('../types').RemoteCommandOpts & import('../types').ProtocolCommandOpts} opts
54
- * @returns {import('../types').RawRemoteCommand}
62
+ * @param opts - Options combining RemoteCommandOpts and ProtocolCommandOpts.
63
+ * @returns A RawRemoteCommand with minimal parameter set.
55
64
  */
56
- getMinimalCommand(opts: import("../types").RemoteCommandOpts & import("../types").ProtocolCommandOpts): import("../types").RawRemoteCommand;
65
+ getMinimalCommand(opts: RemoteCommandOpts & ProtocolCommandOpts): RawRemoteCommand;
57
66
  /**
67
+ * Creates a direct command that bypasses the Target.sendMessageToTarget wrapper.
68
+ * Used for certain Target domain commands.
58
69
  *
59
- * @param {import('../types').RemoteCommandOpts & import('../types').ProtocolCommandOpts} opts
60
- * @returns {import('../types').RawRemoteCommand}
70
+ * @param opts - Options combining RemoteCommandOpts and ProtocolCommandOpts.
71
+ * @returns A RawRemoteCommand for direct protocol communication.
61
72
  */
62
- getDirectCommand(opts: import("../types").RemoteCommandOpts & import("../types").ProtocolCommandOpts): import("../types").RawRemoteCommand;
73
+ getDirectCommand(opts: RemoteCommandOpts & ProtocolCommandOpts): RawRemoteCommand;
63
74
  /**
75
+ * Gets a remote command based on the command name and options.
76
+ * Handles both Safari Web Inspector commands and WebKit protocol commands.
64
77
  *
65
- * @param {string} command
66
- * @param {import('../types').RemoteCommandOpts} opts
67
- * @returns {import('../types').RawRemoteCommand}
78
+ * @param command - The command name (e.g., 'setConnectionKey', 'Page.navigate').
79
+ * @param opts - Options for the command.
80
+ * @returns A RawRemoteCommand appropriate for the given command.
81
+ * @throws Error if required parameters are missing for specific commands.
68
82
  */
69
- getRemoteCommand(command: string, opts: import("../types").RemoteCommandOpts): import("../types").RawRemoteCommand;
83
+ getRemoteCommand(command: string, opts: RemoteCommandOpts & RemoteCommandId): RawRemoteCommand;
70
84
  }
71
- export default RemoteMessages;
85
+ /**
86
+ * Checks if a command should use the direct command format.
87
+ * Direct commands bypass the Target.sendMessageToTarget wrapper.
88
+ *
89
+ * @param command - The command name to check.
90
+ * @returns True if the command should use direct format, false otherwise.
91
+ */
92
+ export declare function isDirectCommand(command: string): boolean;
72
93
  //# sourceMappingURL=remote-messages.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"remote-messages.d.ts","sourceRoot":"","sources":["../../../lib/rpc/remote-messages.js"],"names":[],"mappings":"AA8SA;;;;GAIG;AACH,yCAHW,MAAM,GACJ,OAAO,CAInB;AAzRD;IAGE;;;;OAIG;IACH,yBAHW,MAAM,GACJ,OAAO,UAAU,EAAE,gBAAgB,CAS/C;IAED;;;;;OAKG;IACH,qBAJW,MAAM,YACN,OAAO,UAAU,EAAE,QAAQ,GACzB,OAAO,UAAU,EAAE,gBAAgB,CAU/C;IAED;;;;;;;OAOG;IACH,qBANW,MAAM,YACN,MAAM,YACN,OAAO,UAAU,EAAE,QAAQ,cAC3B,OAAO,UAAU,EAAE,SAAS,GAC1B,OAAO,UAAU,EAAE,gBAAgB,CAa/C;IAED;;;;;;;OAOG;IACH,wBANW,MAAM,YACN,OAAO,UAAU,EAAE,QAAQ,cAC3B,OAAO,UAAU,EAAE,SAAS,YAC5B,OAAO,GACL,OAAO,UAAU,EAAE,gBAAgB,CAY/C;IAED;;;;OAIG;IACH,4BA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C,EAAE,OAAO,GAAG,gBAAgB;IAY/G;;;;;OAKG;IACH,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,gBAAgB;IASrD;;;;;;OAMG;IACH,cAAc,CAAC,IAAI,EAAE,iBAAiB,GAAG,mBAAmB,GAAG,gBAAgB;IAqD/E;;;;;;OAMG;IACH,iBAAiB,CAAC,IAAI,EAAE,iBAAiB,GAAG,mBAAmB,GAAG,gBAAgB;IA6BlF;;;;;;OAMG;IACH,gBAAgB,CAAC,IAAI,EAAE,iBAAiB,GAAG,mBAAmB,GAAG,gBAAgB;IAoBjF;;;;;;;;OAQG;IACH,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,GAAG,eAAe,GAAG,gBAAgB;CAwD/F;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAExD"}
@@ -13,7 +13,7 @@ const FULL_COMMAND = 'getFullCommand';
13
13
  const DIRECT_COMMAND = 'getDirectCommand';
14
14
  // mapping of commands to the function for getting the command
15
15
  // defaults to `getMinimalCommand`, so no need to have those listed here
16
- const COMMANDS = /** @type {const} */ ({
16
+ const COMMANDS = {
17
17
  'Page.getCookies': FULL_COMMAND,
18
18
  'Page.navigate': FULL_COMMAND,
19
19
  'Runtime.awaitPromise': FULL_COMMAND,
@@ -24,13 +24,18 @@ const COMMANDS = /** @type {const} */ ({
24
24
  'Target.resume': DIRECT_COMMAND,
25
25
  'Timeline.start': FULL_COMMAND,
26
26
  'Timeline.stop': FULL_COMMAND,
27
- });
27
+ };
28
+ /**
29
+ * Generates remote commands for communicating with the Web Inspector.
30
+ * Provides methods for creating various types of commands including connection
31
+ * setup, application management, and protocol commands.
32
+ */
28
33
  class RemoteMessages {
29
- // #region Connection functions
30
34
  /**
35
+ * Creates a command to set the connection key for the Web Inspector session.
31
36
  *
32
- * @param {string} connId
33
- * @returns {import('../types').RawRemoteCommand}
37
+ * @param connId - The connection identifier.
38
+ * @returns A RawRemoteCommand for setting the connection key.
34
39
  */
35
40
  setConnectionKey(connId) {
36
41
  return {
@@ -41,10 +46,11 @@ class RemoteMessages {
41
46
  };
42
47
  }
43
48
  /**
49
+ * Creates a command to connect to a specific application.
44
50
  *
45
- * @param {string} connId
46
- * @param {import('../types').AppIdKey} appIdKey
47
- * @returns {import('../types').RawRemoteCommand}
51
+ * @param connId - The connection identifier.
52
+ * @param appIdKey - The application identifier key.
53
+ * @returns A RawRemoteCommand for connecting to the application.
48
54
  */
49
55
  connectToApp(connId, appIdKey) {
50
56
  return {
@@ -56,12 +62,13 @@ class RemoteMessages {
56
62
  };
57
63
  }
58
64
  /**
65
+ * Creates a command to set the sender key for message routing.
59
66
  *
60
- * @param {string} connId
61
- * @param {string} senderId
62
- * @param {import('../types').AppIdKey} appIdKey
63
- * @param {import('../types').PageIdKey} [pageIdKey]
64
- * @returns {import('../types').RawRemoteCommand}
67
+ * @param connId - The connection identifier.
68
+ * @param senderId - The sender identifier.
69
+ * @param appIdKey - The application identifier key.
70
+ * @param pageIdKey - Optional page identifier key.
71
+ * @returns A RawRemoteCommand for setting the sender key.
65
72
  */
66
73
  setSenderKey(connId, senderId, appIdKey, pageIdKey) {
67
74
  return {
@@ -76,12 +83,13 @@ class RemoteMessages {
76
83
  };
77
84
  }
78
85
  /**
86
+ * Creates a command to indicate web view status.
79
87
  *
80
- * @param {string} connId
81
- * @param {import('../types').AppIdKey} appIdKey
82
- * @param {import('../types').PageIdKey} [pageIdKey]
83
- * @param {boolean} [enabled]
84
- * @returns {import('../types').RawRemoteCommand}
88
+ * @param connId - The connection identifier.
89
+ * @param appIdKey - The application identifier key.
90
+ * @param pageIdKey - Optional page identifier key.
91
+ * @param enabled - Whether the web view indication is enabled. Defaults to true if not provided.
92
+ * @returns A RawRemoteCommand for indicating web view status.
85
93
  */
86
94
  indicateWebView(connId, appIdKey, pageIdKey, enabled) {
87
95
  return {
@@ -95,9 +103,10 @@ class RemoteMessages {
95
103
  };
96
104
  }
97
105
  /**
106
+ * Creates a command to launch an application.
98
107
  *
99
- * @param {string} bundleId
100
- * @returns {import('../types').RawRemoteCommand}
108
+ * @param bundleId - The bundle identifier of the application to launch.
109
+ * @returns A RawRemoteCommand for launching the application.
101
110
  */
102
111
  launchApplication(bundleId) {
103
112
  return {
@@ -108,9 +117,11 @@ class RemoteMessages {
108
117
  };
109
118
  }
110
119
  /**
120
+ * Creates a full command with all default parameters included.
121
+ * This includes objectGroup, includeCommandLineAPI, and other runtime options.
111
122
  *
112
- * @param {import('../types').RemoteCommandOpts & import('../types').ProtocolCommandOpts} opts
113
- * @returns {import('../types').RawRemoteCommand}
123
+ * @param opts - Options combining RemoteCommandOpts and ProtocolCommandOpts.
124
+ * @returns A RawRemoteCommand with full parameter set.
114
125
  */
115
126
  getFullCommand(opts) {
116
127
  const { method, params, connId, senderId, appIdKey, pageIdKey, targetId, id, } = opts;
@@ -150,13 +161,14 @@ class RemoteMessages {
150
161
  },
151
162
  __selector: '_rpc_forwardSocketData:',
152
163
  };
153
- // @ts-ignore This is ok
154
164
  return lodash_1.default.omitBy(plist, lodash_1.default.isNil);
155
165
  }
156
166
  /**
167
+ * Creates a minimal command with only the essential parameters.
168
+ * This is the default command type for most operations.
157
169
  *
158
- * @param {import('../types').RemoteCommandOpts & import('../types').ProtocolCommandOpts} opts
159
- * @returns {import('../types').RawRemoteCommand}
170
+ * @param opts - Options combining RemoteCommandOpts and ProtocolCommandOpts.
171
+ * @returns A RawRemoteCommand with minimal parameter set.
160
172
  */
161
173
  getMinimalCommand(opts) {
162
174
  const { method, params, connId, senderId, appIdKey, pageIdKey, targetId, id } = opts;
@@ -182,13 +194,14 @@ class RemoteMessages {
182
194
  },
183
195
  __selector: '_rpc_forwardSocketData:'
184
196
  };
185
- // @ts-ignore This is ok
186
197
  return lodash_1.default.omitBy(plist, lodash_1.default.isNil);
187
198
  }
188
199
  /**
200
+ * Creates a direct command that bypasses the Target.sendMessageToTarget wrapper.
201
+ * Used for certain Target domain commands.
189
202
  *
190
- * @param {import('../types').RemoteCommandOpts & import('../types').ProtocolCommandOpts} opts
191
- * @returns {import('../types').RawRemoteCommand}
203
+ * @param opts - Options combining RemoteCommandOpts and ProtocolCommandOpts.
204
+ * @returns A RawRemoteCommand for direct protocol communication.
192
205
  */
193
206
  getDirectCommand(opts) {
194
207
  const { method, params, connId, senderId, appIdKey, pageIdKey, id } = opts;
@@ -206,14 +219,16 @@ class RemoteMessages {
206
219
  },
207
220
  __selector: '_rpc_forwardSocketData:'
208
221
  };
209
- // @ts-ignore This is ok
210
222
  return lodash_1.default.omitBy(plist, lodash_1.default.isNil);
211
223
  }
212
224
  /**
225
+ * Gets a remote command based on the command name and options.
226
+ * Handles both Safari Web Inspector commands and WebKit protocol commands.
213
227
  *
214
- * @param {string} command
215
- * @param {import('../types').RemoteCommandOpts} opts
216
- * @returns {import('../types').RawRemoteCommand}
228
+ * @param command - The command name (e.g., 'setConnectionKey', 'Page.navigate').
229
+ * @param opts - Options for the command.
230
+ * @returns A RawRemoteCommand appropriate for the given command.
231
+ * @throws Error if required parameters are missing for specific commands.
217
232
  */
218
233
  getRemoteCommand(command, opts) {
219
234
  const { id, connId, appIdKey, senderId, pageIdKey, targetId, } = opts;
@@ -246,9 +261,8 @@ class RemoteMessages {
246
261
  return this.launchApplication(opts.bundleId);
247
262
  }
248
263
  // deal with WebKit commands
249
- const builderFunction = COMMANDS[command] || MINIMAL_COMMAND;
250
- const commonOpts = (0, protocol_1.getProtocolCommand)(
251
- /** @type {string} */ (id), command, opts, isDirectCommand(command));
264
+ const builderFunction = (COMMANDS[command] || MINIMAL_COMMAND);
265
+ const commonOpts = (0, protocol_1.getProtocolCommand)(id, command, opts, isDirectCommand(command));
252
266
  return this[builderFunction]({
253
267
  ...commonOpts,
254
268
  connId,
@@ -261,12 +275,13 @@ class RemoteMessages {
261
275
  }
262
276
  exports.RemoteMessages = RemoteMessages;
263
277
  /**
278
+ * Checks if a command should use the direct command format.
279
+ * Direct commands bypass the Target.sendMessageToTarget wrapper.
264
280
  *
265
- * @param {string} command
266
- * @returns {boolean}
281
+ * @param command - The command name to check.
282
+ * @returns True if the command should use direct format, false otherwise.
267
283
  */
268
284
  function isDirectCommand(command) {
269
285
  return COMMANDS[command] === DIRECT_COMMAND;
270
286
  }
271
- exports.default = RemoteMessages;
272
287
  //# sourceMappingURL=remote-messages.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"remote-messages.js","sourceRoot":"","sources":["../../../lib/rpc/remote-messages.js"],"names":[],"mappings":";;;;;;AAmTA,0CAEC;AArTD,oDAAuB;AACvB,0CAAiD;AAGjD,MAAM,YAAY,GAAG,SAAS,CAAC;AAE/B,MAAM,eAAe,GAAG,mBAAmB,CAAC;AAC5C,MAAM,YAAY,GAAG,gBAAgB,CAAC;AACtC,MAAM,cAAc,GAAG,kBAAkB,CAAC;AAE1C,8DAA8D;AAC9D,wEAAwE;AACxE,MAAM,QAAQ,GAAG,oBAAoB,CAAC,CAAC;IACrC,iBAAiB,EAAE,YAAY;IAC/B,eAAe,EAAE,YAAY;IAE7B,sBAAsB,EAAE,YAAY;IACpC,wBAAwB,EAAE,YAAY;IACtC,kBAAkB,EAAE,YAAY;IAEhC,eAAe,EAAE,cAAc;IAC/B,wBAAwB,EAAE,cAAc;IACxC,eAAe,EAAE,cAAc;IAE/B,gBAAgB,EAAE,YAAY;IAC9B,eAAe,EAAE,YAAY;CAC9B,CAAC,CAAC;AAEH,MAAa,cAAc;IACzB,+BAA+B;IAE/B;;;;OAIG;IACH,gBAAgB,CAAE,MAAM;QACtB,OAAO;YACL,UAAU,EAAE;gBACV,0BAA0B,EAAE,MAAM;aACnC;YACD,UAAU,EAAE,wBAAwB;SACrC,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,YAAY,CAAE,MAAM,EAAE,QAAQ;QAC5B,OAAO;YACL,UAAU,EAAE;gBACV,0BAA0B,EAAE,MAAM;gBAClC,2BAA2B,EAAE,QAAQ;aACtC;YACD,UAAU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EAAE,CAAC;oBACtC,MAAM,IAAI,KAAK,CAAC,sEAAsE,CAAC,CAAC;gBAC1F,CAAC;gBACD,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;YAClE,KAAK,mBAAmB;gBACtB,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;oBACnB,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;gBACnE,CAAC;gBACD,OAAO,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACjD,CAAC;QAED,4BAA4B;QAC5B,MAAM,eAAe,GAAG,CAAC,QAAQ,CAAC,OAAgC,CAAC,IAAI,eAAe,CAA2B,CAAC;QAClH,MAAM,UAAU,GAAG,IAAA,6BAAkB,EACnC,EAAE,EACF,OAAO,EACP,IAAI,EACJ,eAAe,CAAC,OAAO,CAAC,CACzB,CAAC;QACF,OAAO,IAAI,CAAC,eAAe,CAAC,CAAC;YAC3B,GAAG,UAAU;YACb,MAAM;YACN,QAAQ;YACR,QAAQ;YACR,SAAS;YACT,QAAQ;SACT,CAAC,CAAC;IACL,CAAC;CACF;AAvRD,wCAuRC;AAED;;;;;;GAMG;AACH,SAAgB,eAAe,CAAC,OAAe;IAC7C,OAAO,QAAQ,CAAC,OAAgC,CAAC,KAAK,cAAc,CAAC;AACvE,CAAC"}
@@ -1,53 +1,46 @@
1
- export default class RpcMessageHandler extends EventEmitters<any> {
2
- constructor();
1
+ import { EventEmitter } from 'node:events';
2
+ import type { StringRecord } from '@appium/types';
3
+ /**
4
+ * Handles messages from the Web Inspector and dispatches them as events.
5
+ * Extends EventEmitter to provide event-based message handling.
6
+ */
7
+ export default class RpcMessageHandler extends EventEmitter {
3
8
  /**
4
- * Handle a message from the Web Inspector.
9
+ * Handles a message from the Web Inspector by parsing the selector
10
+ * and emitting appropriate events.
5
11
  *
6
- * @param {import('@appium/types').StringRecord} plist
7
- * @returns {Promise<void>}
12
+ * @param plist - The plist message from the Web Inspector containing
13
+ * __selector and __argument properties.
8
14
  */
9
- handleMessage(plist: import("@appium/types").StringRecord): Promise<void>;
15
+ handleMessage(plist: StringRecord): Promise<void>;
10
16
  /**
11
- * Parse the data key from the plist.
17
+ * Parses the data key from a plist message.
18
+ * The data key is a JSON string that needs to be parsed.
12
19
  *
13
- * @param {import('@appium/types').StringRecord} plist
14
- * @returns {DataMessage}
15
- * @throws {Error} if the data key cannot be parsed
20
+ * @param plist - The plist message containing the data key.
21
+ * @returns The parsed DataMessage object.
22
+ * @throws Error if the data key cannot be parsed.
16
23
  */
17
- parseDataKey(plist: import("@appium/types").StringRecord): DataMessage;
24
+ private parseDataKey;
18
25
  /**
19
- * Dispatch a data message.
26
+ * Dispatches a data message by emitting events.
27
+ * If msgId is provided, emits a message-specific event.
28
+ * Otherwise, emits method-based events with appropriate argument mapping.
20
29
  *
21
- * @param {string} msgId If not empty then the following event is going to be emitted:
22
- * - <msgId, error, result>
23
- * If empty then the following event is going to be emitted:
24
- * - <name, error, ..args>
25
- * @param {string | undefined} method
26
- * @param {import('@appium/types').StringRecord | undefined} params
27
- * @param {any} result
28
- * @param {Error | undefined} error
29
- * @returns {Promise<void>}
30
+ * @param msgId - If not empty, emits an event with this ID: <msgId, error, result>.
31
+ * If empty, emits method-based events: <name, error, ...args>.
32
+ * @param method - The method name from the data message.
33
+ * @param params - The parameters from the data message.
34
+ * @param result - The result from the data message.
35
+ * @param error - Any error that occurred during message processing.
30
36
  */
31
- dispatchDataMessage(msgId: string, method: string | undefined, params: import("@appium/types").StringRecord | undefined, result: any, error: Error | undefined): Promise<void>;
37
+ private dispatchDataMessage;
32
38
  /**
33
- * Handle a data message from the Web Inspector.
39
+ * Handles a data message from the Web Inspector by parsing it and
40
+ * dispatching appropriate events based on the message type.
34
41
  *
35
- * @param {import('@appium/types').StringRecord} plist
36
- * @returns {Promise<void>}
42
+ * @param plist - The plist message from the Web Inspector.
37
43
  */
38
- handleDataMessage(plist: import("@appium/types").StringRecord): Promise<void>;
44
+ private handleDataMessage;
39
45
  }
40
- export type DataMessage = {
41
- id?: string | undefined;
42
- method: string;
43
- params: import("@appium/types").StringRecord;
44
- result: any;
45
- error?: string | DataErrorMessage | undefined;
46
- };
47
- export type DataErrorMessage = {
48
- message: string;
49
- code: number;
50
- data: any;
51
- };
52
- import EventEmitters from 'events';
53
46
  //# sourceMappingURL=rpc-message-handler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rpc-message-handler.d.ts","sourceRoot":"","sources":["../../../lib/rpc/rpc-message-handler.js"],"names":[],"mappings":"AAMA;IACE,cAEC;IAED;;;;;OAKG;IACH,qBAHW,OAAO,eAAe,EAAE,YAAY,GAClC,OAAO,CAAC,IAAI,CAAC,CAsDzB;IAED;;;;;;OAMG;IACH,oBAJW,OAAO,eAAe,EAAE,YAAY,GAClC,WAAW,CAUvB;IAED;;;;;;;;;;;;OAYG;IACH,2BAVW,MAAM,UAIN,MAAM,GAAG,SAAS,UAClB,OAAO,eAAe,EAAE,YAAY,GAAG,SAAS,UAChD,GAAG,SACH,KAAK,GAAG,SAAS,GACf,OAAO,CAAC,IAAI,CAAC,CA4DzB;IAED;;;;;OAKG;IACH,yBAHW,OAAO,eAAe,EAAE,YAAY,GAClC,OAAO,CAAC,IAAI,CAAC,CAkEzB;CACF;;;YAKa,MAAM;YACN,OAAO,eAAe,EAAE,YAAY;YACpC,GAAG;;;;aAMH,MAAM;UACN,MAAM;UACN,GAAG;;0BAnPS,QAAQ"}
1
+ {"version":3,"file":"rpc-message-handler.d.ts","sourceRoot":"","sources":["../../../lib/rpc/rpc-message-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAI3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAsBlD;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,YAAY;IACzD;;;;;;OAMG;IACG,aAAa,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAsDvD;;;;;;;OAOG;IACH,OAAO,CAAC,YAAY;IASpB;;;;;;;;;;;OAWG;YACW,mBAAmB;IAgEjC;;;;;OAKG;YACW,iBAAiB;CAiEhC"}