appium-adb 14.1.2 → 14.1.4

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.
Files changed (51) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/build/lib/tools/aab-utils.d.ts +5 -4
  3. package/build/lib/tools/aab-utils.d.ts.map +1 -1
  4. package/build/lib/tools/aab-utils.js +13 -11
  5. package/build/lib/tools/aab-utils.js.map +1 -1
  6. package/build/lib/tools/android-manifest.d.ts +26 -30
  7. package/build/lib/tools/android-manifest.d.ts.map +1 -1
  8. package/build/lib/tools/android-manifest.js +33 -47
  9. package/build/lib/tools/android-manifest.js.map +1 -1
  10. package/build/lib/tools/apks-utils.d.ts +25 -29
  11. package/build/lib/tools/apks-utils.d.ts.map +1 -1
  12. package/build/lib/tools/apks-utils.js +41 -52
  13. package/build/lib/tools/apks-utils.js.map +1 -1
  14. package/build/lib/tools/emulator-commands.d.ts.map +1 -1
  15. package/build/lib/tools/emulator-commands.js +2 -1
  16. package/build/lib/tools/emulator-commands.js.map +1 -1
  17. package/build/lib/tools/fs-commands.d.ts +25 -30
  18. package/build/lib/tools/fs-commands.d.ts.map +1 -1
  19. package/build/lib/tools/fs-commands.js +19 -26
  20. package/build/lib/tools/fs-commands.js.map +1 -1
  21. package/build/lib/tools/general-commands.d.ts +36 -58
  22. package/build/lib/tools/general-commands.d.ts.map +1 -1
  23. package/build/lib/tools/general-commands.js +41 -47
  24. package/build/lib/tools/general-commands.js.map +1 -1
  25. package/build/lib/tools/keyboard-commands.d.ts +27 -36
  26. package/build/lib/tools/keyboard-commands.d.ts.map +1 -1
  27. package/build/lib/tools/keyboard-commands.js +24 -34
  28. package/build/lib/tools/keyboard-commands.js.map +1 -1
  29. package/build/lib/tools/lockmgmt.d.ts +25 -36
  30. package/build/lib/tools/lockmgmt.d.ts.map +1 -1
  31. package/build/lib/tools/lockmgmt.js +34 -38
  32. package/build/lib/tools/lockmgmt.js.map +1 -1
  33. package/build/lib/tools/logcat-commands.d.ts +11 -30
  34. package/build/lib/tools/logcat-commands.d.ts.map +1 -1
  35. package/build/lib/tools/logcat-commands.js +16 -17
  36. package/build/lib/tools/logcat-commands.js.map +1 -1
  37. package/build/lib/tools/network-commands.d.ts +24 -31
  38. package/build/lib/tools/network-commands.d.ts.map +1 -1
  39. package/build/lib/tools/network-commands.js +14 -24
  40. package/build/lib/tools/network-commands.js.map +1 -1
  41. package/lib/tools/{aab-utils.js → aab-utils.ts} +24 -15
  42. package/lib/tools/{android-manifest.js → android-manifest.ts} +66 -59
  43. package/lib/tools/{apks-utils.js → apks-utils.ts} +76 -68
  44. package/lib/tools/emulator-commands.ts +3 -2
  45. package/lib/tools/{fs-commands.js → fs-commands.ts} +41 -35
  46. package/lib/tools/{general-commands.js → general-commands.ts} +71 -68
  47. package/lib/tools/{keyboard-commands.js → keyboard-commands.ts} +42 -49
  48. package/lib/tools/{lockmgmt.js → lockmgmt.ts} +71 -56
  49. package/lib/tools/{logcat-commands.js → logcat-commands.ts} +24 -22
  50. package/lib/tools/{network-commands.js → network-commands.ts} +42 -34
  51. package/package.json +2 -2
@@ -1,15 +1,16 @@
1
1
  import {EOL} from 'os';
2
2
  import _ from 'lodash';
3
3
  import {log} from '../logger.js';
4
+ import type {ADB} from '../adb.js';
5
+ import type {PortFamily, PortInfo} from './types.js';
4
6
 
5
7
  /**
6
8
  * Get TCP port forwarding with adb on the device under test.
7
9
  *
8
- * @this {import('../adb.js').ADB}
9
- * @return {Promise<string[]>} The output of the corresponding adb command.
10
+ * @return The output of the corresponding adb command.
10
11
  * An array contains each forwarding line of output
11
12
  */
12
- export async function getForwardList() {
13
+ export async function getForwardList(this: ADB): Promise<string[]> {
13
14
  log.debug(`List forwarding ports`);
14
15
  const connections = await this.adbExec(['forward', '--list']);
15
16
  return connections.split(EOL).filter((line) => Boolean(line.trim()));
@@ -18,11 +19,14 @@ export async function getForwardList() {
18
19
  /**
19
20
  * Setup TCP port forwarding with adb on the device under test.
20
21
  *
21
- * @this {import('../adb.js').ADB}
22
- * @param {string|number} systemPort - The number of the local system port.
23
- * @param {string|number} devicePort - The number of the remote device port.
22
+ * @param systemPort - The number of the local system port.
23
+ * @param devicePort - The number of the remote device port.
24
24
  */
25
- export async function forwardPort(systemPort, devicePort) {
25
+ export async function forwardPort(
26
+ this: ADB,
27
+ systemPort: string | number,
28
+ devicePort: string | number,
29
+ ): Promise<void> {
26
30
  log.debug(`Forwarding system: ${systemPort} to device: ${devicePort}`);
27
31
  await this.adbExec(['forward', `tcp:${systemPort}`, `tcp:${devicePort}`]);
28
32
  }
@@ -31,11 +35,10 @@ export async function forwardPort(systemPort, devicePort) {
31
35
  * Remove TCP port forwarding with adb on the device under test. The forwarding
32
36
  * for the given port should be setup with {@link #forwardPort} first.
33
37
  *
34
- * @this {import('../adb.js').ADB}
35
- * @param {string|number} systemPort - The number of the local system port
38
+ * @param systemPort - The number of the local system port
36
39
  * to remove forwarding on.
37
40
  */
38
- export async function removePortForward(systemPort) {
41
+ export async function removePortForward(this: ADB, systemPort: string | number): Promise<void> {
39
42
  log.debug(`Removing forwarded port socket connection: ${systemPort} `);
40
43
  await this.adbExec(['forward', `--remove`, `tcp:${systemPort}`]);
41
44
  }
@@ -43,11 +46,10 @@ export async function removePortForward(systemPort) {
43
46
  /**
44
47
  * Get TCP port forwarding with adb on the device under test.
45
48
  *
46
- * @this {import('../adb.js').ADB}
47
- * @return {Promise<string[]>} The output of the corresponding adb command.
49
+ * @return The output of the corresponding adb command.
48
50
  * An array contains each forwarding line of output
49
51
  */
50
- export async function getReverseList() {
52
+ export async function getReverseList(this: ADB): Promise<string[]> {
51
53
  log.debug(`List reverse forwarding ports`);
52
54
  const connections = await this.adbExec(['reverse', '--list']);
53
55
  return connections.split(EOL).filter((line) => Boolean(line.trim()));
@@ -57,11 +59,14 @@ export async function getReverseList() {
57
59
  * Setup TCP port forwarding with adb on the device under test.
58
60
  * Only available for API 21+.
59
61
  *
60
- * @this {import('../adb.js').ADB}
61
- * @param {string|number} devicePort - The number of the remote device port.
62
- * @param {string|number} systemPort - The number of the local system port.
62
+ * @param devicePort - The number of the remote device port.
63
+ * @param systemPort - The number of the local system port.
63
64
  */
64
- export async function reversePort(devicePort, systemPort) {
65
+ export async function reversePort(
66
+ this: ADB,
67
+ devicePort: string | number,
68
+ systemPort: string | number,
69
+ ): Promise<void> {
65
70
  log.debug(`Forwarding device: ${devicePort} to system: ${systemPort}`);
66
71
  await this.adbExec(['reverse', `tcp:${devicePort}`, `tcp:${systemPort}`]);
67
72
  }
@@ -70,11 +75,13 @@ export async function reversePort(devicePort, systemPort) {
70
75
  * Remove TCP port forwarding with adb on the device under test. The forwarding
71
76
  * for the given port should be setup with {@link #forwardPort} first.
72
77
  *
73
- * @this {import('../adb.js').ADB}
74
- * @param {string|number} devicePort - The number of the remote device port
78
+ * @param devicePort - The number of the remote device port
75
79
  * to remove forwarding on.
76
80
  */
77
- export async function removePortReverse(devicePort) {
81
+ export async function removePortReverse(
82
+ this: ADB,
83
+ devicePort: string | number,
84
+ ): Promise<void> {
78
85
  log.debug(`Removing reverse forwarded port socket connection: ${devicePort} `);
79
86
  await this.adbExec(['reverse', `--remove`, `tcp:${devicePort}`]);
80
87
  }
@@ -84,11 +91,14 @@ export async function removePortReverse(devicePort) {
84
91
  * between {@link #forwardPort} is that this method does setup for an abstract
85
92
  * local port.
86
93
  *
87
- * @this {import('../adb.js').ADB}
88
- * @param {string|number} systemPort - The number of the local system port.
89
- * @param {string|number} devicePort - The number of the remote device port.
94
+ * @param systemPort - The number of the local system port.
95
+ * @param devicePort - The number of the remote device port.
90
96
  */
91
- export async function forwardAbstractPort(systemPort, devicePort) {
97
+ export async function forwardAbstractPort(
98
+ this: ADB,
99
+ systemPort: string | number,
100
+ devicePort: string | number,
101
+ ): Promise<void> {
92
102
  log.debug(`Forwarding system: ${systemPort} to abstract device: ${devicePort}`);
93
103
  await this.adbExec(['forward', `tcp:${systemPort}`, `localabstract:${devicePort}`]);
94
104
  }
@@ -96,13 +106,12 @@ export async function forwardAbstractPort(systemPort, devicePort) {
96
106
  /**
97
107
  * Execute ping shell command on the device under test.
98
108
  *
99
- * @this {import('../adb.js').ADB}
100
- * @return {Promise<boolean>} True if the command output contains 'ping' substring.
109
+ * @return True if the command output contains 'ping' substring.
101
110
  * @throws {Error} If there was an error while executing 'ping' command on the
102
111
  * device under test.
103
112
  */
104
- export async function ping() {
105
- let stdout = await this.shell(['echo', 'ping']);
113
+ export async function ping(this: ADB): Promise<boolean> {
114
+ const stdout = await this.shell(['echo', 'ping']);
106
115
  if (stdout.indexOf('ping') === 0) {
107
116
  return true;
108
117
  }
@@ -113,11 +122,10 @@ export async function ping() {
113
122
  * Returns the list of TCP port states of the given family.
114
123
  * Could be empty if no ports are opened.
115
124
  *
116
- * @this {import('../adb.js').ADB}
117
- * @param {import('./types').PortFamily} [family='4']
118
- * @returns {Promise<import('./types').PortInfo[]>}
125
+ * @param family - Port family ('4' for IPv4, '6' for IPv6)
126
+ * @returns Array of port information
119
127
  */
120
- export async function listPorts(family = '4') {
128
+ export async function listPorts(this: ADB, family: PortFamily = '4'): Promise<PortInfo[]> {
121
129
  const sourceProcName = `/proc/net/tcp${family === '6' ? '6' : ''}`;
122
130
  const output = await this.shell(['cat', sourceProcName]);
123
131
  const lines = output.split('\n');
@@ -133,8 +141,7 @@ export async function listPorts(family = '4') {
133
141
  log.debug(lines[0]);
134
142
  throw new Error(`Cannot parse the header row of ${sourceProcName} payload`);
135
143
  }
136
- /** @type {import('./types').PortInfo[]} */
137
- const result = [];
144
+ const result: PortInfo[] = [];
138
145
  // 2: 1002000A:D036 24CE3AD8:01BB 08 00000000:00000000 00:00000000 00000000 10132 0 49104 1 0000000000000000 21 4 20 10 -1
139
146
  for (const line of lines.slice(1)) {
140
147
  const values = line.split(/\s+/).filter(Boolean);
@@ -151,3 +158,4 @@ export async function listPorts(family = '4') {
151
158
  }
152
159
  return result;
153
160
  }
161
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appium-adb",
3
- "version": "14.1.2",
3
+ "version": "14.1.4",
4
4
  "description": "Android Debug Bridge interface",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {
@@ -69,7 +69,7 @@
69
69
  "@types/ini": "^4.1.0",
70
70
  "@types/lodash": "^4.14.195",
71
71
  "@types/mocha": "^10.0.1",
72
- "@types/node": "^24.0.0",
72
+ "@types/node": "^25.0.0",
73
73
  "@types/semver": "^7.5.0",
74
74
  "@types/sinon": "^21.0.0",
75
75
  "@types/source-map-support": "^0.5.6",