appium 2.0.0-beta.27 → 2.0.0-beta.28

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 (118) hide show
  1. package/build/lib/appium.d.ts +215 -0
  2. package/build/lib/appium.d.ts.map +1 -0
  3. package/build/lib/appium.js +53 -39
  4. package/build/lib/cli/args.d.ts +20 -0
  5. package/build/lib/cli/args.d.ts.map +1 -0
  6. package/build/lib/cli/args.js +1 -1
  7. package/build/lib/cli/driver-command.d.ts +36 -0
  8. package/build/lib/cli/driver-command.d.ts.map +1 -0
  9. package/build/lib/cli/driver-command.js +8 -7
  10. package/build/lib/cli/extension-command.d.ts +345 -0
  11. package/build/lib/cli/extension-command.d.ts.map +1 -0
  12. package/build/lib/cli/extension-command.js +52 -38
  13. package/build/lib/cli/extension.d.ts +14 -0
  14. package/build/lib/cli/extension.d.ts.map +1 -0
  15. package/build/lib/cli/extension.js +7 -2
  16. package/build/lib/cli/parser.d.ts +79 -0
  17. package/build/lib/cli/parser.d.ts.map +1 -0
  18. package/build/lib/cli/parser.js +1 -1
  19. package/build/lib/cli/plugin-command.d.ts +39 -0
  20. package/build/lib/cli/plugin-command.d.ts.map +1 -0
  21. package/build/lib/cli/plugin-command.js +6 -7
  22. package/build/lib/cli/utils.d.ts +29 -0
  23. package/build/lib/cli/utils.d.ts.map +1 -0
  24. package/build/lib/cli/utils.js +1 -1
  25. package/build/lib/config-file.d.ts +100 -0
  26. package/build/lib/config-file.d.ts.map +1 -0
  27. package/build/lib/config-file.js +1 -1
  28. package/build/lib/config.d.ts +40 -0
  29. package/build/lib/config.d.ts.map +1 -0
  30. package/build/lib/config.js +2 -2
  31. package/build/lib/constants.d.ts +48 -0
  32. package/build/lib/constants.d.ts.map +1 -0
  33. package/build/lib/constants.js +1 -1
  34. package/build/lib/extension/driver-config.d.ts +84 -0
  35. package/build/lib/extension/driver-config.d.ts.map +1 -0
  36. package/build/lib/extension/driver-config.js +1 -1
  37. package/build/lib/extension/extension-config.d.ts +170 -0
  38. package/build/lib/extension/extension-config.d.ts.map +1 -0
  39. package/build/lib/extension/extension-config.js +2 -2
  40. package/build/lib/extension/index.d.ts +39 -0
  41. package/build/lib/extension/index.d.ts.map +1 -0
  42. package/build/lib/extension/index.js +1 -1
  43. package/build/lib/extension/manifest.d.ts +174 -0
  44. package/build/lib/extension/manifest.d.ts.map +1 -0
  45. package/build/lib/extension/manifest.js +1 -1
  46. package/build/lib/extension/package-changed.d.ts +11 -0
  47. package/build/lib/extension/package-changed.d.ts.map +1 -0
  48. package/build/lib/extension/package-changed.js +1 -1
  49. package/build/lib/extension/plugin-config.d.ts +62 -0
  50. package/build/lib/extension/plugin-config.d.ts.map +1 -0
  51. package/build/lib/extension/plugin-config.js +1 -1
  52. package/build/lib/grid-register.d.ts +10 -0
  53. package/build/lib/grid-register.d.ts.map +1 -0
  54. package/build/lib/logger.d.ts +3 -0
  55. package/build/lib/logger.d.ts.map +1 -0
  56. package/build/lib/logsink.d.ts +4 -0
  57. package/build/lib/logsink.d.ts.map +1 -0
  58. package/build/lib/logsink.js +1 -1
  59. package/build/lib/main.d.ts +51 -0
  60. package/build/lib/main.d.ts.map +1 -0
  61. package/build/lib/main.js +1 -1
  62. package/build/lib/schema/arg-spec.d.ts +143 -0
  63. package/build/lib/schema/arg-spec.d.ts.map +1 -0
  64. package/build/lib/schema/arg-spec.js +1 -1
  65. package/build/lib/schema/cli-args.d.ts +19 -0
  66. package/build/lib/schema/cli-args.d.ts.map +1 -0
  67. package/build/lib/schema/cli-args.js +1 -1
  68. package/build/lib/schema/cli-transformers.d.ts +5 -0
  69. package/build/lib/schema/cli-transformers.d.ts.map +1 -0
  70. package/build/lib/schema/cli-transformers.js +1 -1
  71. package/build/lib/schema/index.d.ts +3 -0
  72. package/build/lib/schema/index.d.ts.map +1 -0
  73. package/build/lib/schema/keywords.d.ts +24 -0
  74. package/build/lib/schema/keywords.d.ts.map +1 -0
  75. package/build/lib/schema/keywords.js +1 -1
  76. package/build/lib/schema/schema.d.ts +259 -0
  77. package/build/lib/schema/schema.d.ts.map +1 -0
  78. package/build/lib/schema/schema.js +3 -3
  79. package/build/lib/utils.d.ts +66 -0
  80. package/build/lib/utils.d.ts.map +1 -0
  81. package/build/lib/utils.js +6 -4
  82. package/build/tsconfig.tsbuildinfo +1 -0
  83. package/lib/appium.js +151 -62
  84. package/lib/cli/args.js +1 -2
  85. package/lib/cli/driver-command.js +11 -8
  86. package/lib/cli/extension-command.js +129 -80
  87. package/lib/cli/extension.js +13 -3
  88. package/lib/cli/parser.js +1 -2
  89. package/lib/cli/plugin-command.js +16 -6
  90. package/lib/cli/utils.js +1 -1
  91. package/lib/config-file.js +3 -4
  92. package/lib/config.js +12 -8
  93. package/lib/constants.js +0 -1
  94. package/lib/extension/driver-config.js +31 -12
  95. package/lib/extension/extension-config.js +21 -22
  96. package/lib/extension/index.js +1 -2
  97. package/lib/extension/manifest.js +23 -127
  98. package/lib/extension/package-changed.js +0 -1
  99. package/lib/extension/plugin-config.js +9 -7
  100. package/lib/logsink.js +4 -0
  101. package/lib/main.js +9 -10
  102. package/lib/schema/arg-spec.js +10 -6
  103. package/lib/schema/cli-args.js +0 -1
  104. package/lib/schema/cli-transformers.js +0 -1
  105. package/lib/schema/keywords.js +0 -1
  106. package/lib/schema/schema.js +2 -3
  107. package/lib/utils.js +49 -16
  108. package/package.json +11 -13
  109. package/types/appium-manifest.d.ts +61 -0
  110. package/types/cli.d.ts +134 -0
  111. package/types/extension.d.ts +56 -0
  112. package/types/external-manifest.d.ts +58 -0
  113. package/types/index.d.ts +7 -0
  114. package/build/lib/appium-config.schema.json +0 -278
  115. package/build/lib/schema/appium-config-schema.js +0 -251
  116. package/lib/schema/appium-config-schema.js +0 -287
  117. package/types/appium-config.d.ts +0 -197
  118. package/types/types.d.ts +0 -245
package/lib/appium.js CHANGED
@@ -1,6 +1,7 @@
1
+ /* eslint-disable no-unused-vars */
1
2
  import _ from 'lodash';
2
3
  import { getBuildInfo, updateBuildInfo, APPIUM_VER } from './config';
3
- import { BaseDriver, errors, isSessionCommand,
4
+ import { BaseDriver, DriverCore, errors, isSessionCommand,
4
5
  CREATE_SESSION_COMMAND, DELETE_SESSION_COMMAND, GET_STATUS_COMMAND
5
6
  } from '@appium/base-driver';
6
7
  import AsyncLock from 'async-lock';
@@ -8,7 +9,11 @@ import { parseCapsForInnerDriver, pullSettings } from './utils';
8
9
  import { util, node, logger } from '@appium/support';
9
10
  import { getDefaultsForExtension } from './schema';
10
11
 
11
- const desiredCapabilityConstraints = {
12
+ /**
13
+ * Invariant set of base constraints
14
+ * @type {Readonly<Constraints>}
15
+ */
16
+ const desiredCapabilityConstraints = Object.freeze({
12
17
  automationName: {
13
18
  presence: true,
14
19
  isString: true,
@@ -17,52 +22,90 @@ const desiredCapabilityConstraints = {
17
22
  presence: true,
18
23
  isString: true,
19
24
  },
20
- };
25
+ });
21
26
 
22
27
  const sessionsListGuard = new AsyncLock();
23
28
  const pendingDriversGuard = new AsyncLock();
24
29
 
25
- class AppiumDriver extends BaseDriver {
26
- constructor (args) {
30
+ /**
31
+ * @implements {SessionHandler}
32
+ */
33
+ class AppiumDriver extends DriverCore {
34
+ /**
35
+ * Access to sessions list must be guarded with a Semaphore, because
36
+ * it might be changed by other async calls at any time
37
+ * It is not recommended to access this property directly from the outside
38
+ * @type {Record<string,ExternalDriver>}
39
+ */
40
+ sessions = {};
41
+
42
+ /**
43
+ * Access to pending drivers list must be guarded with a Semaphore, because
44
+ * it might be changed by other async calls at any time
45
+ * It is not recommended to access this property directly from the outside
46
+ * @type {Record<string,ExternalDriver[]>}
47
+ */
48
+ pendingDrivers = {};
49
+
50
+ /**
51
+ * Note that {@linkcode AppiumDriver} has no `newCommandTimeout` method.
52
+ * `AppiumDriver` does not set and observe its own timeouts; individual
53
+ * sessions (managed drivers) do instead.
54
+ */
55
+ newCommandTimeoutMs = 0;
56
+
57
+ /**
58
+ * List of active plugins
59
+ * @type {PluginClass[]}
60
+ */
61
+ pluginClasses = [];
62
+
63
+ /**
64
+ * map of sessions to actual plugin instances per session
65
+ * @type {Record<string,InstanceType<PluginClass>[]>}
66
+ */
67
+ sessionPlugins = {};
68
+
69
+ /**
70
+ * some commands are sessionless, so we need a set of plugins for them
71
+ * @type {InstanceType<PluginClass>[]}
72
+ */
73
+ sessionlessPlugins = [];;
74
+
75
+ /** @type {DriverConfig} */
76
+ driverConfig;
77
+
78
+ /** @type {AppiumServer} */
79
+ server;
80
+
81
+ /**
82
+ * @param {DriverOpts} opts
83
+ */
84
+ constructor (opts) {
27
85
  // It is necessary to set `--tmp` here since it should be set to
28
86
  // process.env.APPIUM_TMP_DIR once at an initial point in the Appium lifecycle.
29
87
  // The process argument will be referenced by BaseDriver.
30
88
  // Please call @appium/support.tempDir module to apply this benefit.
31
- if (args.tmpDir) {
32
- process.env.APPIUM_TMP_DIR = args.tmpDir;
89
+ if (opts.tmpDir) {
90
+ process.env.APPIUM_TMP_DIR = opts.tmpDir;
33
91
  }
34
92
 
35
- super(args);
93
+ super(opts);
36
94
 
37
95
  this.desiredCapConstraints = desiredCapabilityConstraints;
38
96
 
39
- // the main Appium Driver has no new command timeout
40
- this.newCommandTimeoutMs = 0;
41
-
42
- this.args = {...args};
43
-
44
- // Access to sessions list must be guarded with a Semaphore, because
45
- // it might be changed by other async calls at any time
46
- // It is not recommended to access this property directly from the outside
47
- this.sessions = {};
48
-
49
- // Access to pending drivers list must be guarded with a Semaphore, because
50
- // it might be changed by other async calls at any time
51
- // It is not recommended to access this property directly from the outside
52
- this.pendingDrivers = {};
53
-
54
- /** @type {PluginExtensionClass[]} */
55
- this.pluginClasses = []; // list of which plugins are active
56
- this.sessionPlugins = {}; // map of sessions to actual plugin instances per session
57
- this.sessionlessPlugins = []; // some commands are sessionless, so we need a set of plugins for them
97
+ this.args = {...opts};
58
98
 
59
99
  // allow this to happen in the background, so no `await`
60
- updateBuildInfo();
100
+ // catch this to avoid an unhandled rejection
101
+ // eslint-disable-next-line promise/prefer-await-to-then,promise/prefer-await-to-callbacks
102
+ updateBuildInfo().catch((err) => {
103
+ this.log.debug(err);
104
+ });
61
105
  }
62
106
 
63
107
  /**
64
108
  * Retrieves logger instance for the current umbrella driver instance
65
- * @override
66
109
  */
67
110
  get log () {
68
111
  if (!this._log) {
@@ -72,11 +115,6 @@ class AppiumDriver extends BaseDriver {
72
115
  return this._log;
73
116
  }
74
117
 
75
- /** @type {import('./extension/driver-config').DriverConfig|undefined} */
76
- driverConfig;
77
-
78
- /** @type {import('express').Express|undefined} */
79
- server;
80
118
 
81
119
  /**
82
120
  * Cancel commands queueing for the umbrella Appium driver
@@ -128,12 +166,12 @@ class AppiumDriver extends BaseDriver {
128
166
  * If the extension has provided a schema, validation has already happened.
129
167
  *
130
168
  * Any arg which is equal to its default value will not be assigned to the extension.
131
- * @param {import('./manifest').ExtensionType} extType 'driver' or 'plugin'
169
+ * @param {ExtensionType} extType 'driver' or 'plugin'
132
170
  * @param {string} extName the name of the extension
133
171
  * @param {Object} extInstance the driver or plugin instance
134
172
  */
135
173
  assignCliArgsToExtension (extType, extName, extInstance) {
136
- const allCliArgsForExt = this.args[extType]?.[extName];
174
+ const allCliArgsForExt = /** @type {Record<string,unknown>|undefined} */(this.args[extType]?.[extName]);
137
175
  if (!_.isEmpty(allCliArgsForExt)) {
138
176
  const defaults = getDefaultsForExtension(extType, extName);
139
177
  const cliArgs = _.isEmpty(defaults)
@@ -147,24 +185,26 @@ class AppiumDriver extends BaseDriver {
147
185
 
148
186
  /**
149
187
  * Create a new session
150
- * @param {Object} jsonwpCaps JSONWP formatted desired capabilities
151
- * @param {Object} reqCaps Required capabilities (JSONWP standard)
152
- * @param {Object} w3cCapabilities W3C capabilities
153
- * @return {Array} Unique session ID and capabilities
188
+ * @param {W3CCapabilities} jsonwpCaps JSONWP formatted desired capabilities
189
+ * @param {W3CCapabilities} reqCaps Required capabilities (JSONWP standard)
190
+ * @param {W3CCapabilities} w3cCapabilities W3C capabilities
191
+ * @param {import('@appium/types').DriverData[]} [driverData]
154
192
  */
155
- async createSession (jsonwpCaps, reqCaps, w3cCapabilities) {
193
+ async createSession (jsonwpCaps, reqCaps, w3cCapabilities, driverData) {
156
194
  const defaultCapabilities = _.cloneDeep(this.args.defaultCapabilities);
157
195
  const defaultSettings = pullSettings(defaultCapabilities);
158
196
  jsonwpCaps = _.cloneDeep(jsonwpCaps);
159
- const jwpSettings = Object.assign({}, defaultSettings, pullSettings(jsonwpCaps));
197
+ const jwpSettings = {...defaultSettings, ...pullSettings(jsonwpCaps)};
160
198
  w3cCapabilities = _.cloneDeep(w3cCapabilities);
161
199
  // It is possible that the client only provides caps using JSONWP standard,
162
200
  // although firstMatch/alwaysMatch properties are still present.
163
201
  // In such case we assume the client understands W3C protocol and merge the given
164
202
  // JSONWP caps to W3C caps
165
- const w3cSettings = Object.assign({}, jwpSettings);
166
- Object.assign(w3cSettings, pullSettings((w3cCapabilities || {}).alwaysMatch || {}));
167
- for (const firstMatchEntry of ((w3cCapabilities || {}).firstMatch || [])) {
203
+ const w3cSettings = {
204
+ ...jwpSettings,
205
+ ...pullSettings((w3cCapabilities ?? {}).alwaysMatch ?? {})
206
+ };
207
+ for (const firstMatchEntry of ((w3cCapabilities ?? {}).firstMatch ?? [])) {
168
208
  Object.assign(w3cSettings, pullSettings(firstMatchEntry));
169
209
  }
170
210
 
@@ -179,9 +219,9 @@ class AppiumDriver extends BaseDriver {
179
219
  defaultCapabilities
180
220
  );
181
221
 
182
- const {desiredCaps, processedJsonwpCapabilities, processedW3CCapabilities, error} = parsedCaps;
222
+ const {desiredCaps, processedJsonwpCapabilities, processedW3CCapabilities} = /** @type {import('./utils').ParsedDriverCaps} */(parsedCaps);
183
223
  protocol = parsedCaps.protocol;
184
-
224
+ const error = /** @type {import('./utils').InvalidCaps} */(parsedCaps).error;
185
225
  // If the parsing of the caps produced an error, throw it in here
186
226
  if (error) {
187
227
  throw error;
@@ -198,7 +238,14 @@ class AppiumDriver extends BaseDriver {
198
238
  await this.deleteAllSessions();
199
239
  }
200
240
 
201
- let runningDriversData, otherPendingDriversData;
241
+ /**
242
+ * @type {DriverData[]}
243
+ */
244
+ let runningDriversData = [];
245
+ /**
246
+ * @type {DriverData[]}
247
+ */
248
+ let otherPendingDriversData = [];
202
249
 
203
250
  const driverInstance = new InnerDriver(this.args, true);
204
251
 
@@ -231,21 +278,17 @@ class AppiumDriver extends BaseDriver {
231
278
 
232
279
 
233
280
  // This assignment is required for correct web sockets functionality inside the driver
234
- driverInstance.server = this.server;
235
-
236
281
  // Drivers/plugins might also want to know where they are hosted
237
- driverInstance.serverHost = this.args.address;
238
- driverInstance.serverPort = this.args.port;
239
- driverInstance.serverPath = this.args.basePath;
282
+ driverInstance.assignServer(this.server, this.args.address, this.args.port, this.args.basePath);
240
283
 
241
284
  try {
242
- runningDriversData = await this.curSessionDataForDriver(InnerDriver);
285
+ runningDriversData = await this.curSessionDataForDriver(InnerDriver) ?? [];
243
286
  } catch (e) {
244
287
  throw new errors.SessionNotCreatedError(e.message);
245
288
  }
246
289
  await pendingDriversGuard.acquire(AppiumDriver.name, () => {
247
290
  this.pendingDrivers[InnerDriver.name] = this.pendingDrivers[InnerDriver.name] || [];
248
- otherPendingDriversData = this.pendingDrivers[InnerDriver.name].map((drv) => drv.driverData);
291
+ otherPendingDriversData = _.compact(this.pendingDrivers[InnerDriver.name].map((drv) => drv.driverData));
249
292
  this.pendingDrivers[InnerDriver.name].push(driverInstance);
250
293
  });
251
294
 
@@ -329,11 +372,16 @@ class AppiumDriver extends BaseDriver {
329
372
  }
330
373
  }
331
374
 
375
+ /**
376
+ *
377
+ * @param {import('../types/extension').DriverClass} InnerDriver
378
+ * @returns {Promise<DriverData[]>}}
379
+ */
332
380
  async curSessionDataForDriver (InnerDriver) {
333
381
  const sessions = await sessionsListGuard.acquire(AppiumDriver.name, () => this.sessions);
334
- const data = _.values(sessions)
382
+ const data = _.compact(_.values(sessions)
335
383
  .filter((s) => s.constructor.name === InnerDriver.name)
336
- .map((s) => s.driverData);
384
+ .map((s) => s.driverData));
337
385
  for (let datum of data) {
338
386
  if (!datum) {
339
387
  throw new Error(`Problem getting session data for driver type ` +
@@ -344,12 +392,14 @@ class AppiumDriver extends BaseDriver {
344
392
  return data;
345
393
  }
346
394
 
395
+ /**
396
+ * @param {string} sessionId
397
+ */
347
398
  async deleteSession (sessionId) {
348
399
  let protocol;
349
400
  try {
350
- let otherSessionsData = null;
351
- let dstSession = null;
352
- await sessionsListGuard.acquire(AppiumDriver.name, () => {
401
+ let otherSessionsData;
402
+ const dstSession = await sessionsListGuard.acquire(AppiumDriver.name, () => {
353
403
  if (!this.sessions[sessionId]) {
354
404
  return;
355
405
  }
@@ -357,7 +407,7 @@ class AppiumDriver extends BaseDriver {
357
407
  otherSessionsData = _.toPairs(this.sessions)
358
408
  .filter(([key, value]) => value.constructor.name === curConstructorName && key !== sessionId)
359
409
  .map(([, value]) => value.driverData);
360
- dstSession = this.sessions[sessionId];
410
+ const dstSession = this.sessions[sessionId];
361
411
  protocol = dstSession.protocol;
362
412
  this.log.info(`Removing session ${sessionId} from our master session list`);
363
413
  // regardless of whether the deleteSession completes successfully or not
@@ -365,7 +415,13 @@ class AppiumDriver extends BaseDriver {
365
415
  // be in otherwise
366
416
  delete this.sessions[sessionId];
367
417
  delete this.sessionPlugins[sessionId];
418
+ return dstSession;
368
419
  });
420
+ // this may not be correct, but if `dstSession` was falsy, the call to `deleteSession()` would
421
+ // throw anyway.
422
+ if (!dstSession) {
423
+ throw new Error('Session not found');
424
+ }
369
425
  return {
370
426
  protocol,
371
427
  value: await dstSession.deleteSession(sessionId, otherSessionsData),
@@ -449,6 +505,12 @@ class AppiumDriver extends BaseDriver {
449
505
  });
450
506
  }
451
507
 
508
+ /**
509
+ *
510
+ * @param {string} cmd
511
+ * @param {...any} args
512
+ * @returns {Promise<{value: any, error?: Error, protocol: string} | import('type-fest').AsyncReturnType<import('@appium/types').Driver['executeCommand']>>}
513
+ */
452
514
  async executeCommand (cmd, ...args) {
453
515
  // We have basically three cases for how to handle commands:
454
516
  // 1. handle getStatus (we do this as a special out of band case so it doesn't get added to an
@@ -478,6 +540,7 @@ class AppiumDriver extends BaseDriver {
478
540
  let sessionId = null;
479
541
  let dstSession = null;
480
542
  let protocol = null;
543
+ /** @type {this | ExternalDriver} */
481
544
  let driver = this;
482
545
  if (isSessionCmd) {
483
546
  sessionId = _.last(args);
@@ -535,7 +598,7 @@ class AppiumDriver extends BaseDriver {
535
598
  if (isUmbrellaCmd) {
536
599
  // some commands, like deleteSession, we want to make sure to handle on *this* driver,
537
600
  // not the platform driver
538
- return await super.executeCommand(cmd, ...args);
601
+ return await BaseDriver.prototype.executeCommand.call(this, cmd, ...args);
539
602
  }
540
603
 
541
604
  // here we know that we are executing a session command, and have a valid session driver
@@ -676,3 +739,29 @@ export class NoDriverProxyCommandError extends Error {
676
739
  }
677
740
 
678
741
  export { AppiumDriver };
742
+
743
+ /**
744
+ * @typedef {import('@appium/types').ExternalDriver} ExternalDriver
745
+ * @typedef {import('@appium/types').W3CCapabilities} W3CCapabilities
746
+ * @typedef {import('@appium/types').DriverData} DriverData
747
+ * @typedef {import('@appium/types').DriverOpts} DriverOpts
748
+ * @typedef {import('@appium/types').Constraints} Constraints
749
+ * @typedef {import('@appium/types').AppiumServer} AppiumServer
750
+ * @typedef {import('../types').ExtensionType} ExtensionType
751
+ * @typedef {import('../types/extension').PluginClass} PluginClass
752
+ * @typedef {import('./extension/driver-config').DriverConfig} DriverConfig
753
+ */
754
+
755
+ /**
756
+ * Used by {@linkcode AppiumDriver.createSession} and {@linkcode AppiumDriver.deleteSession} to describe
757
+ * result.
758
+ * @template V
759
+ * @typedef SessionHandlerResult
760
+ * @property {V} [value]
761
+ * @property {Error} [error]
762
+ * @property {string} [protocol]
763
+ */
764
+
765
+ /**
766
+ * @typedef {import('@appium/types').SessionHandler<SessionHandlerResult<any[]>,SessionHandlerResult<void>>} SessionHandler
767
+ */
package/lib/cli/args.js CHANGED
@@ -1,4 +1,3 @@
1
- // @ts-check
2
1
 
3
2
  // @ts-ignore
4
3
  import _ from 'lodash';
@@ -43,7 +42,7 @@ const getExtensionArgs = _.memoize(function getExtensionArgs () {
43
42
  [EXT_SUBCOMMAND_RUN]: makeRunArgs(type),
44
43
  };
45
44
  }
46
- return /** @type {Record<ExtensionType, Record<import('../../types/types').CliExtensionSubcommand,ArgumentDefinitions>>} */(extensionArgs);
45
+ return /** @type {Record<ExtensionType, Record<import('../../types/cli').CliExtensionSubcommand,ArgumentDefinitions>>} */(extensionArgs);
47
46
  });
48
47
 
49
48
  /**
@@ -1,33 +1,36 @@
1
1
  import _ from 'lodash';
2
2
  import ExtensionCommand from './extension-command';
3
- import { DRIVER_TYPE, KNOWN_DRIVERS } from '../constants';
3
+ import { KNOWN_DRIVERS } from '../constants';
4
+ import '@colors/colors';
4
5
 
5
6
  const REQ_DRIVER_FIELDS = ['driverName', 'automationName', 'platformNames', 'mainClass'];
6
-
7
+ /**
8
+ * @extends {ExtensionCommand<import('../extension/manifest').DriverType>}
9
+ */
7
10
  export default class DriverCommand extends ExtensionCommand {
8
11
 
9
12
  /**
10
13
  * @param {DriverCommandOptions} opts
11
14
  */
12
15
  constructor ({config, json}) {
13
- super({config, json, type: DRIVER_TYPE});
16
+ super({config, json});
14
17
  this.knownExtensions = KNOWN_DRIVERS;
15
18
  }
16
19
 
17
20
  async install ({driver, installType, packageName}) {
18
- return await super.install({ext: driver, installType, packageName});
21
+ return await super._install({ext: driver, installType, packageName});
19
22
  }
20
23
 
21
24
  async uninstall ({driver}) {
22
- return await super.uninstall({ext: driver});
25
+ return await super._uninstall({ext: driver});
23
26
  }
24
27
 
25
28
  async update ({driver, unsafe}) {
26
- return await super.update({ext: driver, unsafe});
29
+ return await super._update({ext: driver, unsafe});
27
30
  }
28
31
 
29
32
  async run ({driver, scriptName}) {
30
- return await super.run({ext: driver, scriptName});
33
+ return await super._run({ext: driver, scriptName});
31
34
  }
32
35
 
33
36
  getPostInstallText ({extName, extData}) {
@@ -52,6 +55,6 @@ export default class DriverCommand extends ExtensionCommand {
52
55
 
53
56
  /**
54
57
  * @typedef DriverCommandOptions
55
- * @property {import('../extension/driver-config').DriverConfig} config
58
+ * @property {import('../extension/extension-config').ExtensionConfig<import('../extension/manifest').DriverType>} config
56
59
  * @property {boolean} json
57
60
  */