appium 3.2.2 → 3.3.1

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 (250) hide show
  1. package/build/lib/appium.d.ts +147 -205
  2. package/build/lib/appium.d.ts.map +1 -1
  3. package/build/lib/appium.js +169 -282
  4. package/build/lib/appium.js.map +1 -1
  5. package/build/lib/bidi-commands.d.ts.map +1 -1
  6. package/build/lib/bidi-commands.js +11 -11
  7. package/build/lib/bidi-commands.js.map +1 -1
  8. package/build/lib/bootstrap/appium-initializer.d.ts +21 -0
  9. package/build/lib/bootstrap/appium-initializer.d.ts.map +1 -0
  10. package/build/lib/bootstrap/appium-initializer.js +146 -0
  11. package/build/lib/bootstrap/appium-initializer.js.map +1 -0
  12. package/build/lib/bootstrap/appium-main-runner.d.ts +22 -0
  13. package/build/lib/bootstrap/appium-main-runner.d.ts.map +1 -0
  14. package/build/lib/bootstrap/appium-main-runner.js +109 -0
  15. package/build/lib/bootstrap/appium-main-runner.js.map +1 -0
  16. package/build/lib/bootstrap/config-file.d.ts +37 -0
  17. package/build/lib/bootstrap/config-file.d.ts.map +1 -0
  18. package/build/lib/{config-file.js → bootstrap/config-file.js} +62 -138
  19. package/build/lib/bootstrap/config-file.js.map +1 -0
  20. package/build/lib/bootstrap/grid-v3-register.d.ts +20 -0
  21. package/build/lib/bootstrap/grid-v3-register.d.ts.map +1 -0
  22. package/build/lib/bootstrap/grid-v3-register.js +185 -0
  23. package/build/lib/bootstrap/grid-v3-register.js.map +1 -0
  24. package/build/lib/bootstrap/init-types.d.ts +16 -0
  25. package/build/lib/bootstrap/init-types.d.ts.map +1 -0
  26. package/build/lib/bootstrap/init-types.js +3 -0
  27. package/build/lib/bootstrap/init-types.js.map +1 -0
  28. package/build/lib/bootstrap/main-helpers.d.ts +55 -0
  29. package/build/lib/bootstrap/main-helpers.d.ts.map +1 -0
  30. package/build/lib/bootstrap/main-helpers.js +187 -0
  31. package/build/lib/bootstrap/main-helpers.js.map +1 -0
  32. package/build/lib/bootstrap/node-helpers.d.ts +32 -0
  33. package/build/lib/bootstrap/node-helpers.d.ts.map +1 -0
  34. package/build/lib/bootstrap/node-helpers.js +201 -0
  35. package/build/lib/bootstrap/node-helpers.js.map +1 -0
  36. package/build/lib/bootstrap/startup-config.d.ts +22 -0
  37. package/build/lib/bootstrap/startup-config.d.ts.map +1 -0
  38. package/build/lib/bootstrap/startup-config.js +111 -0
  39. package/build/lib/bootstrap/startup-config.js.map +1 -0
  40. package/build/lib/cli/args.d.ts +16 -12
  41. package/build/lib/cli/args.d.ts.map +1 -1
  42. package/build/lib/cli/args.js +20 -40
  43. package/build/lib/cli/args.js.map +1 -1
  44. package/build/lib/cli/driver-command.d.ts +51 -93
  45. package/build/lib/cli/driver-command.d.ts.map +1 -1
  46. package/build/lib/cli/driver-command.js +11 -66
  47. package/build/lib/cli/driver-command.js.map +1 -1
  48. package/build/lib/cli/extension-command.d.ts +173 -377
  49. package/build/lib/cli/extension-command.d.ts.map +1 -1
  50. package/build/lib/cli/extension-command.js +387 -656
  51. package/build/lib/cli/extension-command.js.map +1 -1
  52. package/build/lib/cli/extension.d.ts +10 -15
  53. package/build/lib/cli/extension.d.ts.map +1 -1
  54. package/build/lib/cli/extension.js +15 -33
  55. package/build/lib/cli/extension.js.map +1 -1
  56. package/build/lib/cli/parser.d.ts +37 -66
  57. package/build/lib/cli/parser.d.ts.map +1 -1
  58. package/build/lib/cli/parser.js +69 -104
  59. package/build/lib/cli/parser.js.map +1 -1
  60. package/build/lib/cli/plugin-command.d.ts +50 -90
  61. package/build/lib/cli/plugin-command.d.ts.map +1 -1
  62. package/build/lib/cli/plugin-command.js +11 -63
  63. package/build/lib/cli/plugin-command.js.map +1 -1
  64. package/build/lib/cli/setup-command.d.ts +21 -26
  65. package/build/lib/cli/setup-command.d.ts.map +1 -1
  66. package/build/lib/cli/setup-command.js +19 -61
  67. package/build/lib/cli/setup-command.js.map +1 -1
  68. package/build/lib/cli/utils.d.ts +33 -35
  69. package/build/lib/cli/utils.d.ts.map +1 -1
  70. package/build/lib/cli/utils.js +48 -50
  71. package/build/lib/cli/utils.js.map +1 -1
  72. package/build/lib/constants.d.ts +23 -23
  73. package/build/lib/constants.d.ts.map +1 -1
  74. package/build/lib/constants.js +10 -15
  75. package/build/lib/constants.js.map +1 -1
  76. package/build/lib/doctor/doctor.d.ts +40 -57
  77. package/build/lib/doctor/doctor.d.ts.map +1 -1
  78. package/build/lib/doctor/doctor.js +31 -62
  79. package/build/lib/doctor/doctor.js.map +1 -1
  80. package/build/lib/extension/driver-config.d.ts +18 -77
  81. package/build/lib/extension/driver-config.d.ts.map +1 -1
  82. package/build/lib/extension/driver-config.js +37 -125
  83. package/build/lib/extension/driver-config.js.map +1 -1
  84. package/build/lib/extension/extension-config.d.ts +103 -210
  85. package/build/lib/extension/extension-config.d.ts.map +1 -1
  86. package/build/lib/extension/extension-config.js +180 -342
  87. package/build/lib/extension/extension-config.js.map +1 -1
  88. package/build/lib/extension/index.d.ts +12 -29
  89. package/build/lib/extension/index.d.ts.map +1 -1
  90. package/build/lib/extension/index.js +33 -75
  91. package/build/lib/extension/index.js.map +1 -1
  92. package/build/lib/extension/manifest-migrations.d.ts +3 -20
  93. package/build/lib/extension/manifest-migrations.d.ts.map +1 -1
  94. package/build/lib/extension/manifest-migrations.js +20 -101
  95. package/build/lib/extension/manifest-migrations.js.map +1 -1
  96. package/build/lib/extension/manifest.d.ts +61 -107
  97. package/build/lib/extension/manifest.d.ts.map +1 -1
  98. package/build/lib/extension/manifest.js +181 -356
  99. package/build/lib/extension/manifest.js.map +1 -1
  100. package/build/lib/extension/package-changed.d.ts +1 -3
  101. package/build/lib/extension/package-changed.d.ts.map +1 -1
  102. package/build/lib/extension/package-changed.js +8 -15
  103. package/build/lib/extension/package-changed.js.map +1 -1
  104. package/build/lib/extension/plugin-config.d.ts +10 -52
  105. package/build/lib/extension/plugin-config.d.ts.map +1 -1
  106. package/build/lib/extension/plugin-config.js +11 -63
  107. package/build/lib/extension/plugin-config.js.map +1 -1
  108. package/build/lib/helpers/build.d.ts +22 -0
  109. package/build/lib/helpers/build.d.ts.map +1 -0
  110. package/build/lib/helpers/build.js +109 -0
  111. package/build/lib/helpers/build.js.map +1 -0
  112. package/build/lib/helpers/capability.d.ts +38 -0
  113. package/build/lib/helpers/capability.d.ts.map +1 -0
  114. package/build/lib/helpers/capability.js +128 -0
  115. package/build/lib/helpers/capability.js.map +1 -0
  116. package/build/lib/helpers/network.d.ts +14 -0
  117. package/build/lib/helpers/network.d.ts.map +1 -0
  118. package/build/lib/helpers/network.js +35 -0
  119. package/build/lib/helpers/network.js.map +1 -0
  120. package/build/lib/insecure-features.js +6 -6
  121. package/build/lib/insecure-features.js.map +1 -1
  122. package/build/lib/inspector-commands.d.ts +6 -0
  123. package/build/lib/inspector-commands.d.ts.map +1 -1
  124. package/build/lib/inspector-commands.js +6 -0
  125. package/build/lib/inspector-commands.js.map +1 -1
  126. package/build/lib/logger.d.ts +2 -3
  127. package/build/lib/logger.d.ts.map +1 -1
  128. package/build/lib/logger.js +2 -3
  129. package/build/lib/logger.js.map +1 -1
  130. package/build/lib/logsink.d.ts +13 -22
  131. package/build/lib/logsink.d.ts.map +1 -1
  132. package/build/lib/logsink.js +48 -103
  133. package/build/lib/logsink.js.map +1 -1
  134. package/build/lib/main.d.ts +15 -58
  135. package/build/lib/main.d.ts.map +1 -1
  136. package/build/lib/main.js +25 -425
  137. package/build/lib/main.js.map +1 -1
  138. package/build/lib/schema/arg-spec.d.ts +32 -107
  139. package/build/lib/schema/arg-spec.d.ts.map +1 -1
  140. package/build/lib/schema/arg-spec.js +11 -107
  141. package/build/lib/schema/arg-spec.js.map +1 -1
  142. package/build/lib/schema/cli-args-guards.d.ts +34 -0
  143. package/build/lib/schema/cli-args-guards.d.ts.map +1 -0
  144. package/build/lib/schema/cli-args-guards.js +49 -0
  145. package/build/lib/schema/cli-args-guards.js.map +1 -0
  146. package/build/lib/schema/cli-args.d.ts +3 -15
  147. package/build/lib/schema/cli-args.d.ts.map +1 -1
  148. package/build/lib/schema/cli-args.js +17 -107
  149. package/build/lib/schema/cli-args.js.map +1 -1
  150. package/build/lib/schema/cli-transformers.d.ts +15 -12
  151. package/build/lib/schema/cli-transformers.d.ts.map +1 -1
  152. package/build/lib/schema/cli-transformers.js +15 -45
  153. package/build/lib/schema/cli-transformers.js.map +1 -1
  154. package/build/lib/schema/format-errors.d.ts +28 -0
  155. package/build/lib/schema/format-errors.d.ts.map +1 -0
  156. package/build/lib/schema/format-errors.js +29 -0
  157. package/build/lib/schema/format-errors.js.map +1 -0
  158. package/build/lib/schema/index.d.ts +4 -2
  159. package/build/lib/schema/index.d.ts.map +1 -1
  160. package/build/lib/schema/index.js +2 -0
  161. package/build/lib/schema/index.js.map +1 -1
  162. package/build/lib/schema/keywords.d.ts +12 -20
  163. package/build/lib/schema/keywords.d.ts.map +1 -1
  164. package/build/lib/schema/keywords.js +6 -51
  165. package/build/lib/schema/keywords.js.map +1 -1
  166. package/build/lib/schema/schema.d.ts +106 -231
  167. package/build/lib/schema/schema.d.ts.map +1 -1
  168. package/build/lib/schema/schema.js +88 -358
  169. package/build/lib/schema/schema.js.map +1 -1
  170. package/build/lib/utils.d.ts +7 -267
  171. package/build/lib/utils.d.ts.map +1 -1
  172. package/build/lib/utils.js +10 -409
  173. package/build/lib/utils.js.map +1 -1
  174. package/lib/{appium.js → appium.ts} +297 -341
  175. package/lib/bidi-commands.ts +10 -14
  176. package/lib/bootstrap/appium-initializer.ts +212 -0
  177. package/lib/bootstrap/appium-main-runner.ts +172 -0
  178. package/lib/bootstrap/config-file.ts +178 -0
  179. package/lib/bootstrap/grid-v3-register.ts +250 -0
  180. package/lib/bootstrap/init-types.ts +31 -0
  181. package/lib/bootstrap/main-helpers.ts +223 -0
  182. package/lib/bootstrap/node-helpers.ts +180 -0
  183. package/lib/bootstrap/startup-config.ts +143 -0
  184. package/lib/cli/{args.js → args.ts} +45 -56
  185. package/lib/cli/driver-command.ts +122 -0
  186. package/lib/cli/{extension-command.js → extension-command.ts} +827 -906
  187. package/lib/cli/extension.ts +65 -0
  188. package/lib/cli/{parser.js → parser.ts} +93 -116
  189. package/lib/cli/plugin-command.ts +117 -0
  190. package/lib/cli/{setup-command.js → setup-command.ts} +59 -74
  191. package/lib/cli/utils.ts +97 -0
  192. package/lib/{constants.js → constants.ts} +30 -41
  193. package/lib/doctor/{doctor.js → doctor.ts} +82 -92
  194. package/lib/extension/driver-config.ts +165 -0
  195. package/lib/extension/{extension-config.js → extension-config.ts} +291 -405
  196. package/lib/extension/index.ts +143 -0
  197. package/lib/extension/manifest-migrations.ts +57 -0
  198. package/lib/extension/manifest.ts +369 -0
  199. package/lib/extension/{package-changed.js → package-changed.ts} +9 -18
  200. package/lib/extension/plugin-config.ts +62 -0
  201. package/lib/helpers/build.ts +111 -0
  202. package/lib/helpers/capability.ts +171 -0
  203. package/lib/helpers/network.ts +30 -0
  204. package/lib/insecure-features.ts +1 -1
  205. package/lib/inspector-commands.ts +6 -1
  206. package/lib/{logger.js → logger.ts} +1 -2
  207. package/lib/{logsink.js → logsink.ts} +91 -137
  208. package/lib/main.ts +60 -0
  209. package/lib/schema/arg-spec.ts +131 -0
  210. package/lib/schema/cli-args-guards.ts +67 -0
  211. package/lib/schema/cli-args.ts +171 -0
  212. package/lib/schema/cli-transformers.ts +83 -0
  213. package/lib/schema/format-errors.ts +43 -0
  214. package/lib/schema/index.ts +4 -0
  215. package/lib/schema/keywords.ts +96 -0
  216. package/lib/schema/schema.ts +448 -0
  217. package/lib/utils.ts +73 -0
  218. package/package.json +17 -18
  219. package/scripts/autoinstall-extensions.js +3 -0
  220. package/build/lib/config-file.d.ts +0 -100
  221. package/build/lib/config-file.d.ts.map +0 -1
  222. package/build/lib/config-file.js.map +0 -1
  223. package/build/lib/config.d.ts +0 -70
  224. package/build/lib/config.d.ts.map +0 -1
  225. package/build/lib/config.js +0 -390
  226. package/build/lib/config.js.map +0 -1
  227. package/build/lib/grid-register.d.ts +0 -10
  228. package/build/lib/grid-register.d.ts.map +0 -1
  229. package/build/lib/grid-register.js +0 -134
  230. package/build/lib/grid-register.js.map +0 -1
  231. package/lib/cli/driver-command.js +0 -174
  232. package/lib/cli/extension.js +0 -74
  233. package/lib/cli/plugin-command.js +0 -164
  234. package/lib/cli/utils.js +0 -91
  235. package/lib/config-file.js +0 -228
  236. package/lib/config.js +0 -389
  237. package/lib/extension/driver-config.js +0 -245
  238. package/lib/extension/index.js +0 -169
  239. package/lib/extension/manifest-migrations.js +0 -136
  240. package/lib/extension/manifest.js +0 -550
  241. package/lib/extension/plugin-config.js +0 -112
  242. package/lib/grid-register.js +0 -146
  243. package/lib/main.js +0 -545
  244. package/lib/schema/arg-spec.js +0 -229
  245. package/lib/schema/cli-args.js +0 -254
  246. package/lib/schema/cli-transformers.js +0 -113
  247. package/lib/schema/index.js +0 -2
  248. package/lib/schema/keywords.js +0 -136
  249. package/lib/schema/schema.js +0 -725
  250. package/lib/utils.js +0 -512
@@ -6,44 +6,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.DriverConfig = void 0;
7
7
  const lodash_1 = __importDefault(require("lodash"));
8
8
  const constants_1 = require("../constants");
9
- const logger_1 = __importDefault(require("../logger"));
9
+ const logger_1 = require("../logger");
10
10
  const extension_config_1 = require("./extension-config");
11
- /**
12
- * @extends {ExtensionConfig<DriverType>}
13
- */
14
11
  class DriverConfig extends extension_config_1.ExtensionConfig {
15
- /**
16
- * A set of unique automation names used by drivers.
17
- * @type {Set<string>}
18
- */
19
- knownAutomationNames;
20
- /**
21
- * A mapping of {@link Manifest} instances to {@link DriverConfig} instances.
22
- *
23
- * `Manifest` and `ExtensionConfig` have a one-to-many relationship; each `Manifest` should be associated with a `DriverConfig` and a `PluginConfig`; no more, no less.
24
- *
25
- * This variable tracks the `Manifest`-to-`DriverConfig` portion.
26
- *
27
- * @type {WeakMap<Manifest,DriverConfig>}
28
- * @private
29
- */
30
12
  static _instances = new WeakMap();
31
- /**
32
- * Call {@link DriverConfig.create} instead.
33
- * @private
34
- * @param {import('./manifest').Manifest} manifest - Manifest instance
35
- */
13
+ knownAutomationNames = new Set();
36
14
  constructor(manifest) {
37
15
  super(constants_1.DRIVER_TYPE, manifest);
38
- this.knownAutomationNames = new Set();
39
16
  }
40
- /**
41
- * Creates a new {@link DriverConfig} instance for a {@link Manifest} instance.
42
- *
43
- * @param {Manifest} manifest
44
- * @throws If `manifest` already associated with a `DriverConfig`
45
- * @returns {DriverConfig}
46
- */
47
17
  static create(manifest) {
48
18
  const instance = new DriverConfig(manifest);
49
19
  if (DriverConfig.getInstance(manifest)) {
@@ -52,28 +22,48 @@ class DriverConfig extends extension_config_1.ExtensionConfig {
52
22
  DriverConfig._instances.set(manifest, instance);
53
23
  return instance;
54
24
  }
55
- /**
56
- * Returns a DriverConfig associated with a Manifest
57
- * @param {Manifest} manifest
58
- * @returns {DriverConfig|undefined}
59
- */
60
25
  static getInstance(manifest) {
61
26
  return DriverConfig._instances.get(manifest);
62
27
  }
63
- /**
64
- * Checks extensions for problems
65
- */
66
28
  async validate() {
67
29
  this.knownAutomationNames.clear();
68
30
  return await super._validate(this.manifest.getExtensionData(constants_1.DRIVER_TYPE));
69
31
  }
70
- /**
71
- * @param {ExtManifest<DriverType>} extData
72
- * @returns {import('./extension-config').ExtManifestProblem[]}
73
- */
74
- getConfigProblems(extData) {
32
+ extensionDesc(driverName, { version, automationName }) {
33
+ return `${String(driverName)}@${version} (automationName '${automationName}')`;
34
+ }
35
+ async findMatchingDriver({ automationName, platformName, }) {
36
+ if (!lodash_1.default.isString(platformName)) {
37
+ throw new Error('You must include a platformName capability');
38
+ }
39
+ if (!lodash_1.default.isString(automationName)) {
40
+ throw new Error('You must include an automationName capability');
41
+ }
42
+ logger_1.log.info(`Attempting to find matching driver for automationName ` +
43
+ `'${automationName}' and platformName '${platformName}'`);
44
+ try {
45
+ const { driverName, mainClass, version } = this._getDriverBySupport(automationName, platformName);
46
+ logger_1.log.info(`The '${driverName}' driver was installed and matched caps.`);
47
+ logger_1.log.info(`Will require it at ${this.getInstallPath(driverName)}`);
48
+ const driver = await this.requireAsync(driverName);
49
+ if (!driver) {
50
+ throw new Error(`Driver '${driverName}' did not export a class with name '${mainClass}'. Contact the author of the driver!`);
51
+ }
52
+ return { driver, version, driverName };
53
+ }
54
+ catch (err) {
55
+ const msg = `Could not find a driver for automationName ` +
56
+ `'${automationName}' and platformName '${platformName}'. ` +
57
+ `Have you installed a driver that supports those ` +
58
+ `capabilities? Run 'appium driver list --installed' to see. ` +
59
+ `(Lower-level error: ${err.message})`;
60
+ throw new Error(msg);
61
+ }
62
+ }
63
+ getConfigProblems(extManifest, extName) {
64
+ void extName;
75
65
  const problems = [];
76
- const { platformNames, automationName } = extData;
66
+ const { platformNames, automationName } = extManifest;
77
67
  if (!lodash_1.default.isArray(platformNames)) {
78
68
  problems.push({
79
69
  err: 'Missing or incorrect supported platformNames list.',
@@ -108,64 +98,15 @@ class DriverConfig extends extension_config_1.ExtensionConfig {
108
98
  val: automationName,
109
99
  });
110
100
  }
111
- // should we retain the name at the end of this function, once we've checked there are no problems?
112
101
  this.knownAutomationNames.add(automationName);
113
102
  return problems;
114
103
  }
115
- /**
116
- * @param {ExtName<DriverType>} driverName
117
- * @param {ExtManifest<DriverType>} extData
118
- * @returns {string}
119
- */
120
- extensionDesc(driverName, { version, automationName }) {
121
- return `${driverName}@${version} (automationName '${automationName}')`;
122
- }
123
- /**
124
- * Given capabilities, find a matching driver within the config. Load its class and return it along with version and driver name.
125
- * @template {import('@appium/types').StringRecord} C
126
- * @param {C} caps
127
- * @returns {Promise<MatchedDriver>}
128
- */
129
- async findMatchingDriver({ automationName, platformName }) {
130
- if (!lodash_1.default.isString(platformName)) {
131
- throw new Error('You must include a platformName capability');
132
- }
133
- if (!lodash_1.default.isString(automationName)) {
134
- throw new Error('You must include an automationName capability');
135
- }
136
- logger_1.default.info(`Attempting to find matching driver for automationName ` +
137
- `'${automationName}' and platformName '${platformName}'`);
138
- try {
139
- const { driverName, mainClass, version } = this._getDriverBySupport(automationName, platformName);
140
- logger_1.default.info(`The '${driverName}' driver was installed and matched caps.`);
141
- logger_1.default.info(`Will require it at ${this.getInstallPath(driverName)}`);
142
- const driver = await this.requireAsync(driverName);
143
- if (!driver) {
144
- throw new Error(`Driver '${driverName}' did not export a class with name '${mainClass}'. Contact the author of the driver!`);
145
- }
146
- return { driver, version, driverName };
147
- }
148
- catch (err) {
149
- const msg = `Could not find a driver for automationName ` +
150
- `'${automationName}' and platformName '${platformName}'. ` +
151
- `Have you installed a driver that supports those ` +
152
- `capabilities? Run 'appium driver list --installed' to see. ` +
153
- `(Lower-level error: ${err.message})`;
154
- throw new Error(msg);
155
- }
156
- }
157
- /**
158
- * Given an automation name and platform name, find a suitable driver and return its extension data.
159
- * @param {string} matchAutomationName
160
- * @param {string} matchPlatformName
161
- * @returns {ExtMetadata<DriverType> & import('appium/types').InternalMetadata & import('appium/types').CommonExtMetadata}
162
- */
163
104
  _getDriverBySupport(matchAutomationName, matchPlatformName) {
164
105
  const drivers = this.installedExtensions;
165
106
  for (const [driverName, driverData] of lodash_1.default.toPairs(drivers)) {
166
107
  const { automationName, platformNames } = driverData;
167
108
  const aNameMatches = automationName.toLowerCase() === matchAutomationName.toLowerCase();
168
- const pNameMatches = lodash_1.default.includes(platformNames.map(lodash_1.default.toLower), matchPlatformName.toLowerCase());
109
+ const pNameMatches = lodash_1.default.includes(platformNames.map((p) => lodash_1.default.toLower(p)), matchPlatformName.toLowerCase());
169
110
  if (aNameMatches && pNameMatches) {
170
111
  return { driverName, ...driverData };
171
112
  }
@@ -181,33 +122,4 @@ class DriverConfig extends extension_config_1.ExtensionConfig {
181
122
  }
182
123
  }
183
124
  exports.DriverConfig = DriverConfig;
184
- /**
185
- * @template {ExtensionType} T
186
- * @typedef {import('appium/types').ExtMetadata<T>} ExtMetadata
187
- */
188
- /**
189
- * @template {ExtensionType} T
190
- * @typedef {import('appium/types').ExtManifest<T>} ExtManifest
191
- */
192
- /**
193
- * @typedef {import('@appium/types').ExtensionType} ExtensionType
194
- * @typedef {import('appium/types').ManifestData} ManifestData
195
- * @typedef {import('@appium/types').DriverType} DriverType
196
- * @typedef {import('./manifest').Manifest} Manifest
197
- */
198
- /**
199
- * @template {ExtensionType} T
200
- * @typedef {import('appium/types').ExtRecord<T>} ExtRecord
201
- */
202
- /**
203
- * @template {ExtensionType} T
204
- * @typedef {import('appium/types').ExtName<T>} ExtName
205
- */
206
- /**
207
- * Return value of {@linkcode DriverConfig.findMatchingDriver}
208
- * @typedef MatchedDriver
209
- * @property {import('@appium/types').DriverClass} driver
210
- * @property {string} version
211
- * @property {string} driverName
212
- */
213
125
  //# sourceMappingURL=driver-config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"driver-config.js","sourceRoot":"","sources":["../../../lib/extension/driver-config.js"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AACvB,4CAAyC;AACzC,uDAA4B;AAC5B,yDAAmD;AAEnD;;GAEG;AACH,MAAa,YAAa,SAAQ,kCAAe;IAC/C;;;OAGG;IACH,oBAAoB,CAAC;IAErB;;;;;;;;;OASG;IACH,MAAM,CAAC,UAAU,GAAG,IAAI,OAAO,EAAE,CAAC;IAElC;;;;OAIG;IACH,YAAY,QAAQ;QAClB,KAAK,CAAC,uBAAW,EAAE,QAAQ,CAAC,CAAC;QAE7B,IAAI,CAAC,oBAAoB,GAAG,IAAI,GAAG,EAAE,CAAC;IACxC,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,MAAM,CAAC,QAAQ;QACpB,MAAM,QAAQ,GAAG,IAAI,YAAY,CAAC,QAAQ,CAAC,CAAC;QAC5C,IAAI,YAAY,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC;YACvC,MAAM,IAAI,KAAK,CACb,6BAA6B,QAAQ,CAAC,UAAU,6EAA6E,CAC9H,CAAC;QACJ,CAAC;QACD,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ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AM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;IAC3E,CAAC;;AApJH,oCAqJC"}
@@ -1,284 +1,177 @@
1
- /**
2
- * https://nodejs.org/api/packages.html#package-entry-points
3
- *
4
- * @param {any} exportsValue
5
- * @returns {string | undefined}
6
- */
7
- export function resolveEsmEntryPoint(exportsValue: any): string | undefined;
1
+ import type { ExtensionType } from '@appium/types';
2
+ import type { ExtClass, ExtManifest, ExtName, ExtRecord, InstallType } from 'appium/types';
3
+ import type { SchemaObject } from 'ajv';
4
+ import type { ExtensionList } from '../cli/extension-command';
5
+ import type { Manifest } from './manifest';
8
6
  /**
9
7
  * "npm" install type
10
8
  * Used when extension was installed by npm package name
11
9
  * @remarks _All_ extensions are installed _by_ `npm`, but only this one means the package name was
12
10
  * used to specify it
13
11
  */
14
- export const INSTALL_TYPE_NPM: "npm";
12
+ export declare const INSTALL_TYPE_NPM = "npm";
15
13
  /**
16
14
  * "local" install type
17
15
  * Used when extension was installed from a local path
18
16
  */
19
- export const INSTALL_TYPE_LOCAL: "local";
17
+ export declare const INSTALL_TYPE_LOCAL = "local";
20
18
  /**
21
19
  * "github" install type
22
20
  * Used when extension was installed via GitHub URL
23
21
  */
24
- export const INSTALL_TYPE_GITHUB: "github";
22
+ export declare const INSTALL_TYPE_GITHUB = "github";
25
23
  /**
26
24
  * "git" install type
27
25
  * Used when extensions was installed via Git URL
28
26
  */
29
- export const INSTALL_TYPE_GIT: "git";
27
+ export declare const INSTALL_TYPE_GIT = "git";
30
28
  /**
31
29
  * "dev" install type
32
30
  * Used when automatically detected as a working copy
33
31
  */
34
- export const INSTALL_TYPE_DEV: "dev";
35
- /** @type {Set<InstallType>} */
36
- export const INSTALL_TYPES: Set<InstallType>;
32
+ export declare const INSTALL_TYPE_DEV = "dev";
33
+ export declare const INSTALL_TYPES: Set<InstallType>;
34
+ export type ExtManifestProblem = {
35
+ err: string;
36
+ val: unknown;
37
+ };
38
+ export type ExtManifestWithSchema<E extends ExtensionType> = ExtManifest<E> & {
39
+ schema: NonNullable<ExtManifest<E>['schema']>;
40
+ };
41
+ export type ExtensionConfigMutationOpts = {
42
+ write?: boolean;
43
+ };
37
44
  /**
38
- * This class is abstract. It should not be instantiated directly.
39
- *
40
- * Subclasses should provide the generic parameter to implement.
41
- * @template {ExtensionType} ExtType
45
+ * Shared configuration and validation for installed Appium extensions (drivers or plugins).
46
+ * Subclasses fix the extension kind; do not instantiate this class directly.
42
47
  */
43
- export class ExtensionConfig<ExtType extends ExtensionType> {
44
- /**
45
- * Intended to be called by corresponding instance methods of subclass.
46
- * @private
47
- * @template {ExtensionType} ExtType
48
- * @param {string} appiumHome
49
- * @param {ExtType} extType
50
- * @param {ExtName<ExtType>} extName - Extension name (unique to its type)
51
- * @param {ExtManifestWithSchema<ExtType>} extManifest - Extension config
52
- * @returns {import('ajv').SchemaObject|undefined}
53
- */
54
- private static _readExtensionSchema;
55
- /**
56
- * Returns `true` if a specific {@link ExtManifest} object has a `schema` prop.
57
- * The {@link ExtManifest} object becomes a {@link ExtManifestWithSchema} object.
58
- * @template {ExtensionType} ExtType
59
- * @param {ExtManifest<ExtType>} extManifest
60
- * @returns {extManifest is ExtManifestWithSchema<ExtType>}
61
- */
62
- static extDataHasSchema<ExtType_1 extends ExtensionType>(extManifest: ExtManifest<ExtType_1>): extManifest is ExtManifestWithSchema<ExtType_1>;
63
- /**
64
- * @protected
65
- * @param {ExtType} extensionType - Type of extension
66
- * @param {Manifest} manifest - `Manifest` instance
67
- */
68
- protected constructor();
69
- /**
70
- * The type of extension this class is responsible for.
71
- * @type {ExtType}
72
- */
73
- extensionType: ExtType;
74
- /**
75
- * Manifest data for the extensions of this type.
76
- *
77
- * This data should _not_ be written to by anything but {@linkcode Manifest}.
78
- * @type {Readonly<ExtRecord<ExtType>>}
79
- */
80
- installedExtensions: Readonly<ExtRecord<ExtType>>;
81
- /** @type {import('@appium/types').AppiumLogger} */
82
- log: import("@appium/types").AppiumLogger;
83
- /** @type {Manifest} */
84
- manifest: Manifest;
85
- get manifestPath(): string;
48
+ export declare abstract class ExtensionConfig<ExtType extends ExtensionType> {
49
+ #private;
50
+ readonly extensionType: ExtType;
51
+ readonly manifest: Manifest;
52
+ installedExtensions: ExtRecord<ExtType>;
53
+ protected constructor(extensionType: ExtType, manifest: Manifest);
54
+ /** Path to `extensions.yaml` after the manifest has been read; otherwise undefined. */
55
+ get manifestPath(): string | undefined;
56
+ /** `APPIUM_HOME` directory this config is tied to. */
86
57
  get appiumHome(): string;
87
58
  /**
88
- * Returns a list of errors for a given extension.
59
+ * Type guard: manifest entry includes a `schema` path or inline schema object.
89
60
  *
90
- * @param {ExtName<ExtType>} extName
91
- * @param {ExtManifest<ExtType>} extManifest
92
- * @returns {ExtManifestProblem[]}
61
+ * @param extManifest - Parsed extension metadata
93
62
  */
94
- getProblems(extName: ExtName<ExtType>, extManifest: ExtManifest<ExtType>): ExtManifestProblem[];
63
+ static extDataHasSchema<E extends ExtensionType>(extManifest: ExtManifest<E>): extManifest is ExtManifestWithSchema<E>;
64
+ private static _readExtensionSchema;
95
65
  /**
96
- * Returns a list of warnings for a given extension.
66
+ * Collects blocking validation issues for one extension (generic fields, type-specific rules, and schema).
97
67
  *
98
- * @param {ExtName<ExtType>} extName
99
- * @param {ExtManifest<ExtType>} extManifest
100
- * @returns {Promise<string[]>}
68
+ * @param extName - Extension key as stored in the manifest
69
+ * @param extManifest - Manifest entry for that extension
101
70
  */
102
- getWarnings(extName: ExtName<ExtType>, extManifest: ExtManifest<ExtType>): Promise<string[]>;
71
+ getProblems(extName: string, extManifest: ExtManifest<ExtType>): Promise<ExtManifestProblem[]>;
103
72
  /**
104
- * Returns a list of extension-type-specific issues. To be implemented by subclasses.
105
- * @abstract
106
- * @param {ExtManifest<ExtType>} extManifest
107
- * @param {ExtName<ExtType>} extName
108
- * @returns {Promise<string[]>}
73
+ * Collects non-fatal issues for one extension (e.g. manifest quirks, peer dependency mismatches).
74
+ * Warnings do not by themselves prevent loading.
75
+ *
76
+ * @param extName - Extension key as stored in the manifest
77
+ * @param extManifest - Manifest entry for that extension
109
78
  */
110
- getConfigWarnings(extManifest: ExtManifest<ExtType>, extName: ExtName<ExtType>): Promise<string[]>;
79
+ getWarnings(extName: string, extManifest: ExtManifest<ExtType>): Promise<string[]>;
111
80
  /**
81
+ * Turns per-extension errors and warnings into human-readable log lines for console output.
112
82
  *
113
- * @param {Map<ExtName<ExtType>,ExtManifestProblem[]>} [errorMap]
114
- * @param {Map<ExtName<ExtType>,string[]>} [warningMap]
83
+ * @param errorMap - Extension name to list of blocking problems
84
+ * @param warningMap - Extension name to list of warning strings
115
85
  */
116
- getValidationResultSummaries(errorMap?: Map<ExtName<ExtType>, ExtManifestProblem[]>, warningMap?: Map<ExtName<ExtType>, string[]>): {
86
+ getValidationResultSummaries(errorMap?: Map<string, ExtManifestProblem[]>, warningMap?: Map<string, string[]>): {
117
87
  errorSummaries: string[];
118
88
  warningSummaries: string[];
119
89
  };
120
90
  /**
121
- * Checks extensions for problems. To be called by subclasses' `validate` method.
91
+ * Records a new installed extension in the manifest and optionally persists immediately.
122
92
  *
123
- * Errors and warnings will be displayed to the user.
93
+ * @param extName - Manifest key for the extension
94
+ * @param extManifest - Full manifest payload
124
95
  *
125
- * This method mutates `exts`.
126
- *
127
- * @protected
128
- * @param {ExtRecord<ExtType>} exts - Lookup of extension names to {@linkcode ExtManifest} objects
129
- * @returns {Promise<ExtRecord<ExtType>>} The same lookup, but picking only error-free extensions
96
+ * Pass `{ write: false }` to defer flushing until a later manifest write.
130
97
  */
131
- protected _validate(exts: ExtRecord<ExtType>): Promise<ExtRecord<ExtType>>;
132
- /**
133
- * Retrieves listing data for extensions via command class.
134
- *
135
- * This is an expensive operation, so the result is cached. Currently, there is no
136
- * use case for invalidating the cache.
137
- * @protected
138
- * @returns {Promise<import('../cli/extension-command').ExtensionList<ExtType>>}
139
- */
140
- protected getListData(): Promise<import("../cli/extension-command").ExtensionList<ExtType>>;
98
+ addExtension(extName: string, extManifest: ExtManifest<ExtType>, { write }?: ExtensionConfigMutationOpts): Promise<void>;
141
99
  /**
142
- * Returns a list of warnings for a particular extension.
100
+ * Merges new metadata into an existing extension entry and optionally writes the manifest.
143
101
  *
144
- * By definition, a non-empty list of warnings does _not_ imply the extension cannot be loaded,
145
- * but it may not work as expected or otherwise throw an exception at runtime.
102
+ * @param extName - Installed extension to update
103
+ * @param extManifest - Fields to merge over the current entry
146
104
  *
147
- * @param {ExtManifest<ExtType>} extManifest
148
- * @param {ExtName<ExtType>} extName
149
- * @returns {Promise<string[]>}
150
- */
151
- getGenericConfigWarnings(extManifest: ExtManifest<ExtType>, extName: ExtName<ExtType>): Promise<string[]>;
152
- /**
153
- * Returns list of unrecoverable errors (if any) for the given extension _if_ it has a `schema` property.
154
- *
155
- * @param {ExtManifest<ExtType>} extManifest - Extension data (from manifest)
156
- * @param {ExtName<ExtType>} extName - Extension name (from manifest)
157
- * @returns {ExtManifestProblem[]}
158
- */
159
- getSchemaProblems(extManifest: ExtManifest<ExtType>, extName: ExtName<ExtType>): ExtManifestProblem[];
160
- /**
161
- * Return a list of generic unrecoverable errors for the given extension
162
- * @param {ExtManifest<ExtType>} extManifest - Extension data (from manifest)
163
- * @param {ExtName<ExtType>} extName - Extension name (from manifest)
164
- * @returns {ExtManifestProblem[]}
165
- */
166
- getGenericConfigProblems(extManifest: ExtManifest<ExtType>, extName: ExtName<ExtType>): ExtManifestProblem[];
167
- /**
168
- * @abstract
169
- * @param {ExtManifest<ExtType>} extManifest
170
- * @param {ExtName<ExtType>} extName
171
- * @returns {ExtManifestProblem[]}
172
- */
173
- getConfigProblems(extManifest: ExtManifest<ExtType>, extName: ExtName<ExtType>): ExtManifestProblem[];
174
- /**
175
- * @param {string} extName
176
- * @param {ExtManifest<ExtType>} extManifest
177
- * @param {ExtensionConfigMutationOpts} opts
178
- * @returns {Promise<void>}
179
- */
180
- addExtension(extName: string, extManifest: ExtManifest<ExtType>, { write }?: ExtensionConfigMutationOpts): Promise<void>;
181
- /**
182
- * @param {ExtName<ExtType>} extName
183
- * @param {ExtManifest<ExtType>} extManifest
184
- * @param {ExtensionConfigMutationOpts} opts
185
- * @returns {Promise<void>}
105
+ * Pass `{ write: false }` to defer flushing until a later manifest write.
186
106
  */
187
107
  updateExtension(extName: ExtName<ExtType>, extManifest: ExtManifest<ExtType>, { write }?: ExtensionConfigMutationOpts): Promise<void>;
188
108
  /**
189
- * Remove an extension from the list of installed extensions, and optionally avoid a write to the manifest file.
109
+ * Drops an extension from the manifest and optionally persists immediately.
110
+ *
111
+ * @param extName - Installed extension to remove
190
112
  *
191
- * @param {ExtName<ExtType>} extName
192
- * @param {ExtensionConfigMutationOpts} opts
193
- * @returns {Promise<void>}
113
+ * Pass `{ write: false }` to defer flushing until a later manifest write.
194
114
  */
195
115
  removeExtension(extName: ExtName<ExtType>, { write }?: ExtensionConfigMutationOpts): Promise<void>;
196
116
  /**
197
- * @param {ExtName<ExtType>[]} [activeNames]
198
- * @returns {void}
117
+ * Logs installed extensions to the console. Subclasses may use `activeNames` to annotate active plugins.
199
118
  */
200
- print(activeNames?: ExtName<ExtType>[]): void;
119
+ print(_activeNames?: ExtName<ExtType>[]): void;
201
120
  /**
202
- * Returns a string describing the extension. Subclasses must implement.
203
- * @param {ExtName<ExtType>} extName - Extension name
204
- * @param {ExtManifest<ExtType>} extManifest - Extension data
205
- * @returns {string}
206
- * @abstract
207
- */
208
- extensionDesc(extName: ExtName<ExtType>, extManifest: ExtManifest<ExtType>): string;
209
- /**
210
- * Returns--with reasonable accuracy--the path on disk to the extension.
121
+ * Root directory of an installed extension, preferring `installPath` and falling back to `node_modules/<pkgName>`.
211
122
  *
212
- * If `installPath` is present in the manifest, then it is used; otherwise we just guess.
213
- * @param {keyof typeof this.installedExtensions} extName
214
- * @returns {string}
123
+ * @param extName - Installed extension key
215
124
  */
216
- getInstallPath(extName: keyof typeof this.installedExtensions): string;
125
+ getInstallPath(extName: keyof ExtRecord<ExtType> & string): string;
217
126
  /**
127
+ * Dynamically imports the extension entry point and returns the exported main class constructor.
218
128
  *
219
- * @param {ExtName<ExtType>} extName
220
- * @returns {Promise<[string, string]>}
129
+ * @param extName - Installed extension to load
221
130
  */
222
- _resolveExtension(extName: ExtName<ExtType>): Promise<[string, string]>;
131
+ requireAsync(extName: ExtName<ExtType>): Promise<ExtClass<ExtType>>;
132
+ /** Whether the manifest lists an extension under the given name. */
133
+ isInstalled(extName: string): boolean;
223
134
  /**
224
- * Loads extension asynchronously and returns its main class (constructor)
135
+ * Loads the extension’s config schema from disk or inline JSON and registers it for CLI/config validation.
225
136
  *
226
- * @param {ExtName<ExtType>} extName
227
- * @returns {Promise<ExtClass<ExtType>>}
137
+ * @param extName - Extension key
138
+ * @param extManifest - Manifest entry that includes `schema`
228
139
  */
229
- requireAsync(extName: ExtName<ExtType>): Promise<ExtClass<ExtType>>;
140
+ readExtensionSchema(extName: string, extManifest: ExtManifestWithSchema<ExtType>): Promise<SchemaObject | undefined>;
141
+ /** Optional async warnings for this extension kind; override in subclasses when needed. */
142
+ protected getConfigWarnings(_extManifest: ExtManifest<ExtType>, _extName: string): Promise<string[]>;
230
143
  /**
231
- * @param {string} extName
232
- * @returns {boolean}
144
+ * Validates all entries in `exts`, logs summaries, and removes keys that have blocking errors.
145
+ * Intended for subclasses’ `validate` implementation.
233
146
  */
234
- isInstalled(extName: string): boolean;
147
+ protected _validate(exts: ExtRecord<ExtType>): Promise<ExtRecord<ExtType>>;
235
148
  /**
236
- * If an extension provides a schema, this will load the schema and attempt to
237
- * register it with the schema registrar.
238
- * @param {ExtName<ExtType>} extName - Name of extension
239
- * @param {ExtManifestWithSchema<ExtType>} extManifest - Extension data
240
- * @returns {import('ajv').SchemaObject|undefined}
149
+ * Fetches `appium driver|plugin list`-style data via the CLI command class; result is cached.
241
150
  */
242
- readExtensionSchema(extName: ExtName<ExtType>, extManifest: ExtManifestWithSchema<ExtType>): import("ajv").SchemaObject | undefined;
243
- #private;
244
- }
245
- /**
246
- * An issue with the {@linkcode ExtManifest} for a particular extension.
247
- *
248
- * The existance of such an object implies that the extension cannot be loaded.
249
- */
250
- export type ExtManifestProblem = {
151
+ protected getListData(): Promise<ExtensionList<ExtType>>;
251
152
  /**
252
- * - Error message
153
+ * Warnings about manifest install fields and Appium peer dependency compatibility for one extension.
253
154
  */
254
- err: string;
155
+ protected getGenericConfigWarnings(extManifest: ExtManifest<ExtType>, extName: string): Promise<string[]>;
156
+ /** Validates and registers extension CLI/config schema when the manifest defines a `schema` field. */
157
+ protected getSchemaProblems(extManifest: ExtManifest<ExtType>, extName: string): Promise<ExtManifestProblem[]>;
158
+ /** Blocking issues for required manifest fields shared by all extensions (version, package name, main class). */
159
+ protected getGenericConfigProblems(extManifest: ExtManifest<ExtType>, extName: string): ExtManifestProblem[];
160
+ /** Driver- or plugin-specific blocking validation; override in subclasses when needed. */
161
+ protected getConfigProblems(_extManifest: ExtManifest<ExtType>, _extName: string): ExtManifestProblem[];
162
+ private _resolveExtension;
255
163
  /**
256
- * - Associated value
164
+ * One-line human description for list output; implemented per extension kind.
165
+ *
166
+ * @param extName - Manifest key
167
+ * @param extManifest - Entry used for version and kind-specific labels
257
168
  */
258
- val: any;
259
- };
260
- /**
261
- * An optional logging function provided to an {@link ExtensionConfig} subclass.
262
- */
263
- export type ExtensionLogFn = (...args: any[]) => void;
264
- export type ExtensionType = import("@appium/types").ExtensionType;
265
- export type Manifest = import("./manifest").Manifest;
266
- export type InstallType = import("appium/types").InstallType;
267
- export type ExtManifest<ExtType extends ExtensionType> = import("appium/types").ExtManifest<ExtType>;
268
- export type ExtManifestWithSchema<ExtType extends ExtensionType> = ExtManifest<ExtType> & {
269
- schema: NonNullable<ExtManifest<ExtType>["schema"]>;
270
- };
271
- export type ExtName<ExtType extends ExtensionType> = import("appium/types").ExtName<ExtType>;
272
- export type ExtClass<ExtType extends ExtensionType> = import("appium/types").ExtClass<ExtType>;
273
- export type ExtRecord<ExtType extends ExtensionType> = import("appium/types").ExtRecord<ExtType>;
274
- export type ExtCommand<ExtType extends ExtensionType> = import("../cli/extension").ExtCommand<ExtType>;
169
+ abstract extensionDesc(extName: ExtName<ExtType>, extManifest: ExtManifest<ExtType>): string;
170
+ }
275
171
  /**
276
- * Options for various methods in {@link ExtensionConfig}
172
+ * Resolves a package `exports` field (string, `"."`, or `"import"`) to a relative entry path for ESM packages.
173
+ *
174
+ * @param exportsValue - `package.json` `exports` value or nested fragment
277
175
  */
278
- export type ExtensionConfigMutationOpts = {
279
- /**
280
- * Whether or not to write the manifest to disk after a mutation operation
281
- */
282
- write?: boolean | undefined;
283
- };
176
+ export declare function resolveEsmEntryPoint(exportsValue: unknown): string | undefined;
284
177
  //# sourceMappingURL=extension-config.d.ts.map