@appium/base-driver 8.7.3 → 9.0.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.
Files changed (121) hide show
  1. package/build/lib/basedriver/capabilities.d.ts +11 -163
  2. package/build/lib/basedriver/capabilities.d.ts.map +1 -1
  3. package/build/lib/basedriver/capabilities.js +354 -236
  4. package/build/lib/basedriver/capabilities.js.map +1 -1
  5. package/build/lib/basedriver/commands/event.d.ts +7 -6
  6. package/build/lib/basedriver/commands/event.d.ts.map +1 -1
  7. package/build/lib/basedriver/commands/event.js +55 -35
  8. package/build/lib/basedriver/commands/event.js.map +1 -1
  9. package/build/lib/basedriver/commands/execute.d.ts +7 -6
  10. package/build/lib/basedriver/commands/execute.d.ts.map +1 -1
  11. package/build/lib/basedriver/commands/execute.js +66 -58
  12. package/build/lib/basedriver/commands/execute.js.map +1 -1
  13. package/build/lib/basedriver/commands/find.d.ts +9 -7
  14. package/build/lib/basedriver/commands/find.d.ts.map +1 -1
  15. package/build/lib/basedriver/commands/find.js +102 -54
  16. package/build/lib/basedriver/commands/find.js.map +1 -1
  17. package/build/lib/basedriver/commands/index.d.ts +3 -7
  18. package/build/lib/basedriver/commands/index.d.ts.map +1 -1
  19. package/build/lib/basedriver/commands/index.js +30 -33
  20. package/build/lib/basedriver/commands/index.js.map +1 -1
  21. package/build/lib/basedriver/commands/log.d.ts +8 -9
  22. package/build/lib/basedriver/commands/log.d.ts.map +1 -1
  23. package/build/lib/basedriver/commands/log.js +54 -38
  24. package/build/lib/basedriver/commands/log.js.map +1 -1
  25. package/build/lib/basedriver/commands/session.d.ts +7 -6
  26. package/build/lib/basedriver/commands/session.d.ts.map +1 -1
  27. package/build/lib/basedriver/commands/session.js +46 -39
  28. package/build/lib/basedriver/commands/session.js.map +1 -1
  29. package/build/lib/basedriver/commands/settings.d.ts +7 -7
  30. package/build/lib/basedriver/commands/settings.d.ts.map +1 -1
  31. package/build/lib/basedriver/commands/settings.js +35 -28
  32. package/build/lib/basedriver/commands/settings.js.map +1 -1
  33. package/build/lib/basedriver/commands/timeout.d.ts +7 -5
  34. package/build/lib/basedriver/commands/timeout.d.ts.map +1 -1
  35. package/build/lib/basedriver/commands/timeout.js +144 -162
  36. package/build/lib/basedriver/commands/timeout.js.map +1 -1
  37. package/build/lib/basedriver/core.d.ts +6 -157
  38. package/build/lib/basedriver/core.d.ts.map +1 -1
  39. package/build/lib/basedriver/core.js +361 -230
  40. package/build/lib/basedriver/core.js.map +1 -1
  41. package/build/lib/basedriver/desired-caps.js +80 -110
  42. package/build/lib/basedriver/desired-caps.js.map +1 -1
  43. package/build/lib/basedriver/device-settings.js +57 -62
  44. package/build/lib/basedriver/device-settings.js.map +1 -1
  45. package/build/lib/basedriver/driver.d.ts +11 -262
  46. package/build/lib/basedriver/driver.d.ts.map +1 -1
  47. package/build/lib/basedriver/driver.js +362 -262
  48. package/build/lib/basedriver/driver.js.map +1 -1
  49. package/build/lib/basedriver/helpers.js +500 -495
  50. package/build/lib/basedriver/helpers.js.map +1 -1
  51. package/build/lib/basedriver/logger.d.ts +1 -1
  52. package/build/lib/basedriver/logger.d.ts.map +1 -1
  53. package/build/lib/basedriver/logger.js +5 -15
  54. package/build/lib/basedriver/logger.js.map +1 -1
  55. package/build/lib/constants.js +14 -14
  56. package/build/lib/constants.js.map +1 -1
  57. package/build/lib/express/crash.js +8 -15
  58. package/build/lib/express/crash.js.map +1 -1
  59. package/build/lib/express/express-logging.js +49 -59
  60. package/build/lib/express/express-logging.js.map +1 -1
  61. package/build/lib/express/idempotency.js +125 -177
  62. package/build/lib/express/idempotency.js.map +1 -1
  63. package/build/lib/express/logger.d.ts +1 -1
  64. package/build/lib/express/logger.d.ts.map +1 -1
  65. package/build/lib/express/logger.js +5 -15
  66. package/build/lib/express/logger.js.map +1 -1
  67. package/build/lib/express/middleware.js +82 -107
  68. package/build/lib/express/middleware.js.map +1 -1
  69. package/build/lib/express/server.d.ts +17 -5
  70. package/build/lib/express/server.d.ts.map +1 -1
  71. package/build/lib/express/server.js +259 -224
  72. package/build/lib/express/server.js.map +1 -1
  73. package/build/lib/express/static.js +64 -81
  74. package/build/lib/express/static.js.map +1 -1
  75. package/build/lib/express/websocket.js +115 -87
  76. package/build/lib/express/websocket.js.map +1 -1
  77. package/build/lib/helpers/capabilities.d.ts +1 -59
  78. package/build/lib/helpers/capabilities.d.ts.map +1 -1
  79. package/build/lib/helpers/capabilities.js +72 -69
  80. package/build/lib/helpers/capabilities.js.map +1 -1
  81. package/build/lib/index.js +64 -180
  82. package/build/lib/index.js.map +1 -1
  83. package/build/lib/jsonwp-proxy/protocol-converter.js +215 -227
  84. package/build/lib/jsonwp-proxy/protocol-converter.js.map +1 -1
  85. package/build/lib/jsonwp-proxy/proxy.d.ts.map +1 -1
  86. package/build/lib/jsonwp-proxy/proxy.js +355 -393
  87. package/build/lib/jsonwp-proxy/proxy.js.map +1 -1
  88. package/build/lib/jsonwp-status/status.js +119 -130
  89. package/build/lib/jsonwp-status/status.js.map +1 -1
  90. package/build/lib/protocol/errors.d.ts +135 -32
  91. package/build/lib/protocol/errors.d.ts.map +1 -1
  92. package/build/lib/protocol/errors.js +871 -919
  93. package/build/lib/protocol/errors.js.map +1 -1
  94. package/build/lib/protocol/helpers.js +37 -37
  95. package/build/lib/protocol/helpers.js.map +1 -1
  96. package/build/lib/protocol/index.js +22 -109
  97. package/build/lib/protocol/index.js.map +1 -1
  98. package/build/lib/protocol/protocol.js +394 -350
  99. package/build/lib/protocol/protocol.js.map +1 -1
  100. package/build/lib/protocol/routes.d.ts +1238 -4
  101. package/build/lib/protocol/routes.d.ts.map +1 -1
  102. package/build/lib/protocol/routes.js +964 -1327
  103. package/build/lib/protocol/routes.js.map +1 -1
  104. package/build/lib/protocol/validators.js +32 -39
  105. package/build/lib/protocol/validators.js.map +1 -1
  106. package/build/tsconfig.tsbuildinfo +1 -1
  107. package/lib/basedriver/capabilities.js +80 -39
  108. package/lib/basedriver/commands/event.js +10 -5
  109. package/lib/basedriver/commands/execute.js +14 -9
  110. package/lib/basedriver/commands/find.js +18 -12
  111. package/lib/basedriver/commands/index.js +21 -16
  112. package/lib/basedriver/commands/log.js +24 -18
  113. package/lib/basedriver/commands/session.js +10 -5
  114. package/lib/basedriver/commands/settings.js +9 -6
  115. package/lib/basedriver/commands/timeout.js +10 -4
  116. package/lib/basedriver/core.js +2 -3
  117. package/lib/basedriver/driver.js +12 -16
  118. package/lib/express/server.js +6 -3
  119. package/lib/protocol/errors.js +155 -44
  120. package/lib/protocol/routes.js +11 -7
  121. package/package.json +14 -16
@@ -2,8 +2,9 @@ import _ from 'lodash';
2
2
  import {errors, makeArgs, checkParams} from '../../protocol';
3
3
 
4
4
  /**
5
- * @param {SessionBase} Base
6
- * @returns {ExecuteBase}
5
+ * @template {Constraints} C
6
+ * @param {import('./session').SessionBase<C>} Base
7
+ * @returns {ExecuteBase<C>}
7
8
  */
8
9
  export function ExecuteMixin(Base) {
9
10
  /**
@@ -33,9 +34,9 @@ export function ExecuteMixin(Base) {
33
34
  }
34
35
 
35
36
  const Driver = /** @type {DriverClass} */ (this.constructor);
36
- const availableScripts = _.keys(Driver.executeMethodMap);
37
- const commandMetadata = Driver.executeMethodMap[script];
38
- if (!commandMetadata) {
37
+ const commandMetadata = {...Driver.executeMethodMap?.[script]};
38
+ if (!commandMetadata.command) {
39
+ const availableScripts = _.keys(Driver.executeMethodMap);
39
40
  throw new errors.UnsupportedOperationError(
40
41
  `Unsupported execute method '${script}'. Available methods ` +
41
42
  `are: ${availableScripts.join(', ')}`
@@ -50,16 +51,20 @@ export function ExecuteMixin(Base) {
50
51
  checkParams(commandMetadata.params, args, null);
51
52
  }
52
53
  argsToApply = makeArgs({}, args, commandMetadata.params, null);
53
- return await this[Driver.executeMethodMap[script].command](...argsToApply);
54
+ return await this[commandMetadata.command](...argsToApply);
54
55
  }
55
56
  }
56
57
  return ExecuteCommands;
57
58
  }
58
59
 
59
60
  /**
60
- * @typedef {import('@appium/types').ExecuteCommands} IExecuteCommands
61
+ * @typedef {import('@appium/types').IExecuteCommands} IExecuteCommands
61
62
  * @typedef {import('@appium/types').Driver} Driver
62
63
  * @typedef {import('@appium/types').DriverClass} DriverClass
63
- * @typedef {import('./session').SessionBase} SessionBase
64
- * @typedef {import('../driver').BaseDriverBase<import('@appium/types').TimeoutCommands & import('@appium/types').EventCommands & import('@appium/types').FindCommands & import('@appium/types').LogCommands & import('@appium/types').SettingsCommands & import('@appium/types').SessionCommands & IExecuteCommands>} ExecuteBase
64
+ * @typedef {import('@appium/types').Constraints} Constraints
65
+ */
66
+
67
+ /**
68
+ * @template {Constraints} C
69
+ * @typedef {import('../driver').BaseDriverBase<C, import('@appium/types').ITimeoutCommands & import('@appium/types').IEventCommands & import('@appium/types').IFindCommands & import('@appium/types').ILogCommands<C> & import('@appium/types').ISettingsCommands & import('@appium/types').ISessionCommands & IExecuteCommands>} ExecuteBase
65
70
  */
@@ -4,9 +4,9 @@
4
4
  import {errors} from '../../protocol';
5
5
 
6
6
  /**
7
- *
8
- * @param {EventBase} Base
9
- * @returns {FindBase}
7
+ * @template {Constraints} C
8
+ * @param {import('./event').EventBase<C>} Base
9
+ * @returns {FindBase<C>}
10
10
  */
11
11
  export function FindMixin(Base) {
12
12
  /**
@@ -44,16 +44,16 @@ export function FindMixin(Base) {
44
44
  async findElementsFromElement(strategy, selector, elementId) {
45
45
  return await this.findElOrElsWithProcessing(strategy, selector, true, elementId);
46
46
  }
47
- // Override the following function for your own driver, and the rest is taken
48
- // care of!
49
- // Returns an object which adheres to the way the JSON Wire Protocol represents elements:
50
- // { ELEMENT: # } eg: { ELEMENT: 3 } or { ELEMENT: 1.023 }
51
47
  /**
48
+ * Returns an object which adheres to the way the JSON Wire Protocol represents elements:
49
+ *
50
+ * Override this for your own driver!
52
51
  * @template {boolean} Mult
52
+ * @template [Ctx=any]
53
53
  * @param {string} strategy
54
54
  * @param {string} selector
55
55
  * @param {Mult} mult
56
- * @param {string} [context]
56
+ * @param {Ctx} [context]
57
57
  * @returns {Promise<Mult extends true ? Element[] : Element>}
58
58
  */
59
59
  async findElOrEls(strategy, selector, mult, context) {
@@ -68,10 +68,11 @@ export function FindMixin(Base) {
68
68
  }
69
69
  /**
70
70
  * @template {boolean} Mult
71
+ * @template [Ctx=any]
71
72
  * @param {string} strategy
72
73
  * @param {string} selector
73
74
  * @param {Mult} mult
74
- * @param {string} [context]
75
+ * @param {Ctx} [context]
75
76
  * @returns {Promise<Mult extends true ? Element[] : Element>}
76
77
  */
77
78
  async findElOrElsWithProcessing(strategy, selector, mult, context) {
@@ -96,7 +97,12 @@ export function FindMixin(Base) {
96
97
 
97
98
  /**
98
99
  * @typedef {import('@appium/types').Element} Element
99
- * @typedef {import('@appium/types').FindCommands} IFindCommands
100
- * @typedef {import('./event').EventBase} EventBase
101
- * @typedef {import('../driver').BaseDriverBase<import('@appium/types').TimeoutCommands & import('@appium/types').EventCommands & IFindCommands>} FindBase
100
+ * @typedef {import('@appium/types').Constraints} Constraints
101
+ * @typedef {import('@appium/types').IFindCommands} IFindCommands
102
+ * @typedef {import('@appium/types').ITimeoutCommands} ITimeoutCommands
103
+ * @typedef {import('@appium/types').IEventCommands} IEventCommands
104
+ */
105
+ /**
106
+ * @template {Constraints} C
107
+ * @typedef {import('../driver').BaseDriverBase<C, ITimeoutCommands & IEventCommands & IFindCommands>} FindBase
102
108
  */
@@ -1,5 +1,5 @@
1
1
  // @ts-check
2
-
2
+ import _ from 'lodash';
3
3
  import {EventMixin} from './event';
4
4
  import {FindMixin} from './find';
5
5
  import {LogMixin} from './log';
@@ -9,22 +9,27 @@ import {TimeoutMixin} from './timeout';
9
9
  import {ExecuteMixin} from './execute';
10
10
 
11
11
  /**
12
- * Applies all the mixins to the `BaseDriverBase` class.
13
- * Returns a `BaseDriver` class.
14
- * @param {BaseDriverBase} Base
12
+ * Applies all the mixins to the `BaseDriverBase` class; returns a `BaseDriver` class definition.
13
+ * Each mixin is applied in the order it is listed here, and each type is a union with the previous.
14
+ *
15
+ * @template {Constraints} C
16
+ * @param {BaseDriverBase<C>} Base
17
+ */
18
+ export const createBaseDriverClass = _.flow(
19
+ TimeoutMixin,
20
+ EventMixin,
21
+ FindMixin,
22
+ LogMixin,
23
+ SettingsMixin,
24
+ SessionMixin,
25
+ ExecuteMixin
26
+ );
27
+
28
+ /**
29
+ * @template {Constraints} C
30
+ * @typedef {import('../driver').BaseDriverBase<C>} BaseDriverBase
15
31
  */
16
- export function createBaseDriverClass(Base) {
17
- const WithTimeoutCommands = TimeoutMixin(Base);
18
- const WithEventCommands = EventMixin(WithTimeoutCommands);
19
- const WithFindCommands = FindMixin(WithEventCommands);
20
- const WithLogCommands = LogMixin(WithFindCommands);
21
- const WithSettingsCommands = SettingsMixin(WithLogCommands);
22
- const WithSessionCommands = SessionMixin(WithSettingsCommands);
23
- const WithExecuteCommands = ExecuteMixin(WithSessionCommands);
24
- return WithExecuteCommands;
25
- }
26
32
 
27
33
  /**
28
- * @template [T={}]
29
- * @typedef {import('../driver').BaseDriverBase<T>} BaseDriverBase
34
+ * @typedef {import('@appium/types').Constraints} Constraints
30
35
  */
@@ -4,37 +4,40 @@
4
4
  import _ from 'lodash';
5
5
 
6
6
  /**
7
- *
8
- * @param {FindBase} Base
9
- * @returns {LogBase}
7
+ * @template {Constraints} C
8
+ * @param {import('./find').FindBase<C>} Base
9
+ * @returns {LogBase<C>}
10
10
  */
11
11
  export function LogMixin(Base) {
12
12
  /**
13
- * @implements {ILogCommands}
13
+ * @implements {ILogCommands<C>}
14
14
  */
15
15
  class LogCommands extends Base {
16
+ /** @type {Readonly<import('@appium/types').LogDefRecord<C>>} */
17
+ supportedLogTypes;
18
+
16
19
  constructor(...args) {
17
20
  super(...args);
18
- /** @type {Record<string, LogType<Driver>>} */
19
- this.supportedLogTypes = this.supportedLogTypes ?? {};
21
+ this.supportedLogTypes ??= {};
20
22
  }
21
23
 
22
24
  async getLogTypes() {
23
25
  this.log.debug('Retrieving supported log types');
24
- return _.keys(this.supportedLogTypes);
26
+ return Object.keys(this.supportedLogTypes);
25
27
  }
26
28
 
27
29
  /**
28
- * @this {Driver}
29
- * @param {string} logType
30
+ * @this {import('@appium/types').Driver<C>}
31
+ * @param {keyof typeof this.supportedLogTypes} logType
32
+ * @returns {Promise<import('type-fest').AsyncReturnType<typeof this.supportedLogTypes[keyof typeof this.supportedLogTypes]['getter']>>}
30
33
  */
31
34
  async getLog(logType) {
32
- this.log.debug(`Retrieving '${logType}' logs`);
35
+ this.log.debug(`Retrieving '${String(logType)}' logs`);
33
36
 
34
- if (!(await this.getLogTypes()).includes(logType)) {
37
+ if (!(logType in this.supportedLogTypes)) {
35
38
  const logsTypesWithDescriptions = _.mapValues(this.supportedLogTypes, 'description');
36
39
  throw new Error(
37
- `Unsupported log type '${logType}'. ` +
40
+ `Unsupported log type '${String(logType)}'. ` +
38
41
  `Supported types: ${JSON.stringify(logsTypesWithDescriptions)}`
39
42
  );
40
43
  }
@@ -46,13 +49,16 @@ export function LogMixin(Base) {
46
49
  }
47
50
 
48
51
  /**
49
- * @typedef {import('@appium/types').LogCommands} ILogCommands
50
- * @typedef {import('@appium/types').Driver} Driver
51
- * @typedef {import('./find').FindBase} FindBase
52
- * @typedef {import('../driver').BaseDriverBase<import('@appium/types').TimeoutCommands & import('@appium/types').EventCommands & import('@appium/types').FindCommands & ILogCommands>} LogBase
52
+ * @typedef {import('@appium/types').Constraints} Constraints
53
+ * @typedef {import('@appium/types').StringRecord} StringRecord
54
+ */
55
+
56
+ /**
57
+ * @template {Constraints} C
58
+ * @typedef {import('@appium/types').ILogCommands<C>} ILogCommands
53
59
  */
54
60
 
55
61
  /**
56
- * @template T
57
- * @typedef {import('@appium/types').LogType<T>} LogType
62
+ * @template {Constraints} C
63
+ * @typedef {import('../driver').BaseDriverBase<C, import('@appium/types').ITimeoutCommands & import('@appium/types').IEventCommands & import('@appium/types').IFindCommands & ILogCommands<C>>} LogBase
58
64
  */
@@ -4,8 +4,9 @@
4
4
  import _ from 'lodash';
5
5
 
6
6
  /**
7
- * @param {SettingsBase} Base
8
- * @returns {SessionBase}
7
+ * @template {Constraints} C
8
+ * @param {import('./settings').SettingsBase<C>} Base
9
+ * @returns {SessionBase<C>}
9
10
  */
10
11
  export function SessionMixin(Base) {
11
12
  /**
@@ -43,9 +44,13 @@ export function SessionMixin(Base) {
43
44
  }
44
45
 
45
46
  /**
46
- * @typedef {import('@appium/types').SessionCommands} ISessionCommands
47
+ * @typedef {import('@appium/types').ISessionCommands} ISessionCommands
47
48
  * @typedef {import('@appium/types').SingularSessionData} SingularSessionData
48
49
  * @typedef {import('@appium/types').MultiSessionData} MultiSessionData
49
- * @typedef {import('./settings').SettingsBase} SettingsBase
50
- * @typedef {import('../driver').BaseDriverBase<import('@appium/types').TimeoutCommands & import('@appium/types').EventCommands & import('@appium/types').FindCommands & import('@appium/types').LogCommands & import('@appium/types').SettingsCommands & ISessionCommands>} SessionBase
50
+ * @typedef {import('@appium/types').Constraints} Constraints
51
+ */
52
+
53
+ /**
54
+ * @template {Constraints} C
55
+ * @typedef {import('../driver').BaseDriverBase<C, import('@appium/types').ITimeoutCommands & import('@appium/types').IEventCommands & import('@appium/types').IFindCommands & import('@appium/types').ILogCommands<C> & import('@appium/types').ISettingsCommands & ISessionCommands>} SessionBase
51
56
  */
@@ -1,9 +1,9 @@
1
1
  // @ts-check
2
2
 
3
3
  /**
4
- *
5
- * @param {ReturnType<import('./log').LogMixin>} Base
6
- * @returns {SettingsBase}
4
+ * @template {Constraints} C
5
+ * @param {import('./log').LogBase<C>} Base
6
+ * @returns {SettingsBase<C>}
7
7
  */
8
8
  export function SettingsMixin(Base) {
9
9
  /**
@@ -29,7 +29,10 @@ export function SettingsMixin(Base) {
29
29
  }
30
30
 
31
31
  /**
32
- * @typedef {import('@appium/types').SettingsCommands} ISettingsCommands
33
- * @typedef {import('./log').LogBase} LogBase
34
- * @typedef {import('../driver').BaseDriverBase<import('@appium/types').TimeoutCommands & import('@appium/types').EventCommands & import('@appium/types').FindCommands & import('@appium/types').LogCommands & ISettingsCommands>} SettingsBase
32
+ * @typedef {import('@appium/types').Constraints} Constraints
33
+ * @typedef {import('@appium/types').ISettingsCommands} ISettingsCommands
34
+ */
35
+ /**
36
+ * @template {Constraints} C
37
+ * @typedef {import('../driver').BaseDriverBase<C, import('@appium/types').ITimeoutCommands & import('@appium/types').IEventCommands & import('@appium/types').IFindCommands & import('@appium/types').ILogCommands<C> & ISettingsCommands>} SettingsBase
35
38
  */
@@ -10,8 +10,9 @@ import {errors} from '../../protocol';
10
10
  const MIN_TIMEOUT = 0;
11
11
 
12
12
  /**
13
- * @param {import('../driver').BaseDriverBase} Base
14
- * @returns {TimeoutBase}
13
+ * @template {Constraints} C
14
+ * @param {import('../driver').BaseDriverBase<C>} Base
15
+ * @returns {TimeoutBase<C>}
15
16
  */
16
17
  export function TimeoutMixin(Base) {
17
18
  /**
@@ -157,6 +158,11 @@ export function TimeoutMixin(Base) {
157
158
  }
158
159
 
159
160
  /**
160
- * @typedef {import('@appium/types').TimeoutCommands} ITimeoutCommands
161
- * @typedef {import('../driver').BaseDriverBase<ITimeoutCommands>} TimeoutBase
161
+ * @typedef {import('@appium/types').ITimeoutCommands} ITimeoutCommands
162
+ * @typedef {import('@appium/types').Constraints} Constraints
163
+ */
164
+
165
+ /**
166
+ * @template {Constraints} C
167
+ * @typedef {import('../driver').BaseDriverBase<C, ITimeoutCommands>} TimeoutBase
162
168
  */
@@ -29,7 +29,7 @@ class DriverCore {
29
29
  */
30
30
  static baseVersion = BASEDRIVER_VER;
31
31
 
32
- /** @type {ExecuteMethodMap} */
32
+ /** @type {import('@appium/types').ExecuteMethodMap<DriverCore>} */
33
33
  static executeMethodMap = {};
34
34
 
35
35
  /**
@@ -171,7 +171,7 @@ class DriverCore {
171
171
  }
172
172
 
173
173
  /**
174
- * This property controls the way {#executeCommand} method
174
+ * This property controls the way the `executeCommand` method
175
175
  * handles new driver commands received from the client.
176
176
  * Override it for inherited classes only in special cases.
177
177
  *
@@ -420,7 +420,6 @@ export {DriverCore};
420
420
  /**
421
421
  * @typedef {import('@appium/types').Driver} Driver
422
422
  * @typedef {import('@appium/types').Constraints} Constraints
423
- * @typedef {import('@appium/types').ExecuteMethodMap} ExecuteMethodMap
424
423
  * @typedef {import('@appium/types').ServerArgs} ServerArgs
425
424
  * @typedef {import('@appium/types').EventHistory} EventHistory
426
425
  * @typedef {import('@appium/types').AppiumLogger} AppiumLogger
@@ -3,7 +3,6 @@
3
3
 
4
4
  import {
5
5
  validateCaps,
6
- APPIUM_OPTS_CAP,
7
6
  PREFIXED_APPIUM_OPTS_CAP,
8
7
  processCapabilities,
9
8
  promoteAppiumOptions,
@@ -56,8 +55,6 @@ export class BaseDriverCore extends DriverCore {
56
55
  */
57
56
  opts;
58
57
 
59
- static BASE_DESIRED_CAP_CONSTRAINTS = BASE_DESIRED_CAP_CONSTRAINTS;
60
-
61
58
  /**
62
59
  *
63
60
  * @param {DriverOpts<C>} opts
@@ -71,6 +68,10 @@ export class BaseDriverCore extends DriverCore {
71
68
  * blows away {@linkcode DriverCore.opts}.
72
69
  */
73
70
  this.opts = opts;
71
+
72
+ this.caps = {};
73
+
74
+ this.cliArgs = /** @type {CArgs & ServerArgs} */ ({});
74
75
  }
75
76
 
76
77
  /**
@@ -297,16 +298,10 @@ export class BaseDriverCore extends DriverCore {
297
298
  let caps;
298
299
  try {
299
300
  caps = processCapabilities(
300
- originalCaps,
301
+ promoteAppiumOptions(originalCaps),
301
302
  this._desiredCapConstraints,
302
303
  this.shouldValidateCaps
303
304
  );
304
- if (caps[APPIUM_OPTS_CAP]) {
305
- this.log.debug(
306
- `Found ${PREFIXED_APPIUM_OPTS_CAP} capability present; will promote items inside to caps`
307
- );
308
- caps = promoteAppiumOptions(caps);
309
- }
310
305
  caps = fixCaps(caps, this._desiredCapConstraints, this.log);
311
306
  } catch (e) {
312
307
  throw new errors.SessionNotCreatedError(e.message);
@@ -376,7 +371,7 @@ export class BaseDriverCore extends DriverCore {
376
371
 
377
372
  /**
378
373
  *
379
- * @param {Capabilities} caps
374
+ * @param {Capabilities<C>} caps
380
375
  */
381
376
  logExtraCaps(caps) {
382
377
  let extraCaps = _.difference(_.keys(caps), _.keys(this._desiredCapConstraints));
@@ -427,7 +422,6 @@ export default BaseDriver;
427
422
 
428
423
  /**
429
424
  * @typedef {import('@appium/types').HTTPMethod} HTTPMethod
430
- * @typedef {import('@appium/types').ExternalDriver} ExternalDriver
431
425
  * @typedef {import('@appium/types').DriverData} DriverData
432
426
  * @typedef {import('@appium/types').Constraints} Constraints
433
427
  * @typedef {import('@appium/types').Constraint} Constraint
@@ -445,9 +439,10 @@ export default BaseDriver;
445
439
 
446
440
  /**
447
441
  * This is used to extend {@linkcode BaseDriverCore} by the mixins and also external drivers.
442
+ * @template {Constraints} C
448
443
  * @template [Proto={}]
449
444
  * @template [Static={}]
450
- * @typedef {import('@appium/types').Class<BaseDriverCore & Proto,import('@appium/types').DriverStatic & Static>} BaseDriverBase
445
+ * @typedef {import('@appium/types').Class<BaseDriverCore<C> & Proto,import('@appium/types').DriverStatic & Static>} BaseDriverBase
451
446
  */
452
447
 
453
448
  /**
@@ -468,13 +463,14 @@ export default BaseDriver;
468
463
  */
469
464
 
470
465
  /**
471
- * @template {Constraints} C
472
- * @typedef {import('@appium/types').ConstraintsToCaps<C>} ConstraintsToCaps
466
+ * @template {Constraints} [C=BaseDriverCapConstraints]
467
+ * @template {StringRecord} [CArgs=StringRecord]
468
+ * @typedef {import('@appium/types').Driver<C, CArgs>} Driver
473
469
  */
474
470
 
475
471
  /**
476
472
  * @template {Constraints} C
477
- * @typedef {import('@appium/types').Driver<C>} Driver
473
+ * @typedef {import('@appium/types').ExternalDriver<C>} ExternalDriver
478
474
  */
479
475
 
480
476
  /**
@@ -40,7 +40,7 @@ async function server(opts) {
40
40
  routeConfiguringFunction,
41
41
  port,
42
42
  hostname,
43
- cliArgs,
43
+ cliArgs = {},
44
44
  allowCors = true,
45
45
  basePath = DEFAULT_BASE_PATH,
46
46
  extraMethodMap = {},
@@ -277,7 +277,10 @@ export {server, configureServer, normalizeBasePath};
277
277
  /**
278
278
  * @typedef {import('@appium/types').AppiumServer} AppiumServer
279
279
  * @typedef {import('@appium/types').AppiumServerSocket} AppiumServerSocket
280
- * @typedef {import('@appium/types').MethodMap} MethodMap
280
+ */
281
+
282
+ /**
283
+ * @typedef {import('@appium/types').MethodMap<import('@appium/types').ExternalDriver>} MethodMap
281
284
  */
282
285
 
283
286
  /**
@@ -293,7 +296,7 @@ export {server, configureServer, normalizeBasePath};
293
296
  * @typedef ServerOpts
294
297
  * @property {RouteConfiguringFunction} routeConfiguringFunction
295
298
  * @property {number} port
296
- * @property {import('@appium/types').ServerArgs} cliArgs
299
+ * @property {import('@appium/types').ServerArgs} [cliArgs]
297
300
  * @property {string} [hostname]
298
301
  * @property {boolean} [allowCors]
299
302
  * @property {string} [basePath]