appium 2.0.0-beta.57 → 2.0.0-beta.59

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 (76) hide show
  1. package/README.md +3 -2
  2. package/build/lib/appium.d.ts +43 -35
  3. package/build/lib/appium.d.ts.map +1 -1
  4. package/build/lib/appium.js +37 -29
  5. package/build/lib/appium.js.map +1 -1
  6. package/build/lib/cli/args.d.ts.map +1 -1
  7. package/build/lib/cli/args.js +10 -0
  8. package/build/lib/cli/args.js.map +1 -1
  9. package/build/lib/cli/driver-command.d.ts +7 -7
  10. package/build/lib/cli/driver-command.js +7 -7
  11. package/build/lib/cli/driver-command.js.map +1 -1
  12. package/build/lib/cli/extension-command.d.ts +37 -34
  13. package/build/lib/cli/extension-command.d.ts.map +1 -1
  14. package/build/lib/cli/extension-command.js +67 -44
  15. package/build/lib/cli/extension-command.js.map +1 -1
  16. package/build/lib/cli/extension.d.ts +5 -5
  17. package/build/lib/cli/extension.d.ts.map +1 -1
  18. package/build/lib/cli/extension.js +1 -1
  19. package/build/lib/cli/extension.js.map +1 -1
  20. package/build/lib/cli/plugin-command.d.ts +7 -7
  21. package/build/lib/cli/plugin-command.js +7 -7
  22. package/build/lib/cli/plugin-command.js.map +1 -1
  23. package/build/lib/constants.d.ts +8 -1
  24. package/build/lib/constants.d.ts.map +1 -1
  25. package/build/lib/constants.js +9 -2
  26. package/build/lib/constants.js.map +1 -1
  27. package/build/lib/extension/driver-config.d.ts +6 -6
  28. package/build/lib/extension/driver-config.d.ts.map +1 -1
  29. package/build/lib/extension/driver-config.js +5 -7
  30. package/build/lib/extension/driver-config.js.map +1 -1
  31. package/build/lib/extension/extension-config.d.ts +31 -10
  32. package/build/lib/extension/extension-config.d.ts.map +1 -1
  33. package/build/lib/extension/extension-config.js +44 -24
  34. package/build/lib/extension/extension-config.js.map +1 -1
  35. package/build/lib/extension/manifest-migrations.d.ts.map +1 -1
  36. package/build/lib/extension/manifest-migrations.js +29 -13
  37. package/build/lib/extension/manifest-migrations.js.map +1 -1
  38. package/build/lib/extension/manifest.d.ts +5 -5
  39. package/build/lib/extension/manifest.d.ts.map +1 -1
  40. package/build/lib/extension/manifest.js +19 -12
  41. package/build/lib/extension/manifest.js.map +1 -1
  42. package/build/lib/main.d.ts.map +1 -1
  43. package/build/lib/main.js +4 -14
  44. package/build/lib/main.js.map +1 -1
  45. package/build/lib/schema/cli-args.d.ts +1 -1
  46. package/build/lib/schema/cli-args.d.ts.map +1 -1
  47. package/build/lib/schema/cli-args.js +1 -1
  48. package/build/lib/utils.d.ts +118 -12
  49. package/build/lib/utils.d.ts.map +1 -1
  50. package/build/lib/utils.js +8 -10
  51. package/build/lib/utils.js.map +1 -1
  52. package/build/types/manifest/index.d.ts +4 -2
  53. package/build/types/manifest/index.d.ts.map +1 -1
  54. package/build/types/manifest/index.js +4 -2
  55. package/build/types/manifest/index.js.map +1 -1
  56. package/build/types/manifest/v4.d.ts +139 -0
  57. package/build/types/manifest/v4.d.ts.map +1 -0
  58. package/build/types/manifest/v4.js +3 -0
  59. package/build/types/manifest/v4.js.map +1 -0
  60. package/lib/appium.js +42 -31
  61. package/lib/cli/args.js +10 -0
  62. package/lib/cli/driver-command.js +7 -7
  63. package/lib/cli/extension-command.js +76 -54
  64. package/lib/cli/extension.js +5 -5
  65. package/lib/cli/plugin-command.js +7 -7
  66. package/lib/constants.js +9 -1
  67. package/lib/extension/driver-config.js +5 -8
  68. package/lib/extension/extension-config.js +42 -15
  69. package/lib/extension/manifest-migrations.js +31 -15
  70. package/lib/extension/manifest.js +26 -19
  71. package/lib/main.js +11 -16
  72. package/lib/schema/cli-args.js +1 -1
  73. package/lib/utils.js +8 -10
  74. package/package.json +13 -13
  75. package/types/manifest/index.ts +4 -3
  76. package/types/manifest/v4.ts +161 -0
@@ -10,7 +10,7 @@ import path from 'path';
10
10
  import YAML from 'yaml';
11
11
  import {CURRENT_SCHEMA_REV, DRIVER_TYPE, PLUGIN_TYPE} from '../constants';
12
12
  import log from '../logger';
13
- import {INSTALL_TYPE_NPM} from './extension-config';
13
+ import {INSTALL_TYPE_NPM, INSTALL_TYPE_DEV} from './extension-config';
14
14
  import {packageDidChange} from './package-changed';
15
15
  import {migrate} from './manifest-migrations';
16
16
 
@@ -148,27 +148,33 @@ export class Manifest {
148
148
  * Returns a new or existing {@link Manifest} instance, based on the value of `appiumHome`.
149
149
  *
150
150
  * Maintains one instance per value of `appiumHome`.
151
- * @param {string} appiumHome - Path to `APPIUM_HOME`
152
- * @returns {Manifest}
153
151
  */
154
- static getInstance = _.memoize(function _getInstance(appiumHome) {
155
- return new Manifest(appiumHome);
156
- });
152
+ static getInstance = _.memoize(
153
+ /**
154
+ * @param {string} appiumHome - Path to `APPIUM_HOME`
155
+ * @returns {Manifest}
156
+ */
157
+ function _getInstance(appiumHome) {
158
+ return new Manifest(appiumHome);
159
+ }
160
+ );
157
161
 
158
162
  /**
159
163
  * Searches `APPIUM_HOME` for installed extensions and adds them to the manifest.
164
+ * @param {boolean} hasAppiumDependency - This affects whether or not the "dev" `InstallType` is used
160
165
  * @returns {Promise<boolean>} `true` if any extensions were added, `false` otherwise.
161
166
  */
162
- async syncWithInstalledExtensions() {
167
+ async syncWithInstalledExtensions(hasAppiumDependency = false) {
163
168
  // this could be parallelized, but we can't use fs.walk as an async iterator
164
169
  let didChange = false;
165
170
 
166
171
  /**
167
172
  * Listener for the `match` event of a `glob` instance
168
173
  * @param {string} filepath - Path to a `package.json`
174
+ * @param {boolean} [devType] - If `true`, this is an extension in "dev mode"
169
175
  * @returns {Promise<void>}
170
176
  */
171
- const onMatch = async (filepath) => {
177
+ const onMatch = async (filepath, devType = false) => {
172
178
  try {
173
179
  const pkg = JSON.parse(await fs.readFile(filepath, 'utf8'));
174
180
  if (isExtension(pkg)) {
@@ -188,7 +194,8 @@ export class Manifest {
188
194
  ) {
189
195
  log.info(`Discovered installed ${extType} "${name}"`);
190
196
  }
191
- const changed = this.addExtensionFromPackage(pkg, filepath);
197
+ const installType = devType && hasAppiumDependency ? INSTALL_TYPE_DEV : INSTALL_TYPE_NPM;
198
+ const changed = this.addExtensionFromPackage(pkg, filepath, installType);
192
199
  didChange = didChange || changed;
193
200
  }
194
201
  } catch {}
@@ -199,8 +206,9 @@ export class Manifest {
199
206
  * @type {Promise<void>[]}
200
207
  */
201
208
  const queue = [
202
- // look at `package.json` in `APPIUM_HOME` only
203
- onMatch(path.join(this.#appiumHome, 'package.json')),
209
+ // look at `package.json` in `APPIUM_HOME` only.
210
+ // this causes extensions in "dev mode" to be automatically found
211
+ onMatch(path.join(this.#appiumHome, 'package.json'), true),
204
212
  ];
205
213
 
206
214
  // add dependencies to the queue
@@ -252,9 +260,10 @@ export class Manifest {
252
260
  * @template {ExtensionType} ExtType
253
261
  * @param {ExtPackageJson<ExtType>} pkgJson
254
262
  * @param {string} pkgPath
263
+ * @param {typeof INSTALL_TYPE_NPM | typeof INSTALL_TYPE_DEV} [installType]
255
264
  * @returns {boolean} - `true` if this method did anything.
256
265
  */
257
- addExtensionFromPackage(pkgJson, pkgPath) {
266
+ addExtensionFromPackage(pkgJson, pkgPath, installType = INSTALL_TYPE_NPM) {
258
267
  const extensionPath = path.dirname(pkgPath);
259
268
 
260
269
  /**
@@ -264,7 +273,7 @@ export class Manifest {
264
273
  pkgName: pkgJson.name,
265
274
  version: pkgJson.version,
266
275
  appiumVersion: pkgJson.peerDependencies?.appium,
267
- installType: INSTALL_TYPE_NPM,
276
+ installType,
268
277
  installSpec: `${pkgJson.name}@${pkgJson.version}`,
269
278
  installPath: extensionPath,
270
279
  };
@@ -434,6 +443,8 @@ export class Manifest {
434
443
  shouldWrite = await migrate(this);
435
444
  }
436
445
 
446
+ const hasAppiumDependency = await env.hasAppiumDependency(this.appiumHome);
447
+
437
448
  /**
438
449
  * we still may want to sync with installed extensions even if we have a
439
450
  * new file. right now this is limited to the following cases:
@@ -445,13 +456,9 @@ export class Manifest {
445
456
  * It may also make sense to sync with the extensions in an arbitrary
446
457
  * `APPIUM_HOME`, but we don't do that here.
447
458
  */
448
- if (
449
- shouldWrite ||
450
- ((await env.hasAppiumDependency(this.appiumHome)) &&
451
- (await packageDidChange(this.appiumHome)))
452
- ) {
459
+ if (shouldWrite || (hasAppiumDependency && (await packageDidChange(this.appiumHome)))) {
453
460
  log.debug('Discovering newly installed extensions...');
454
- shouldWrite = (await this.syncWithInstalledExtensions()) || shouldWrite;
461
+ shouldWrite = (await this.syncWithInstalledExtensions(hasAppiumDependency)) || shouldWrite;
455
462
  }
456
463
 
457
464
  if (shouldWrite) {
package/lib/main.js CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  import {init as logsinkInit} from './logsink'; // this import needs to come first since it sets up global npmlog
4
4
  import logger from './logger'; // logger needs to remain second
5
- // @ts-ignore
6
5
  import {routeConfiguringFunction as makeRouter, server as baseServer} from '@appium/base-driver';
7
6
  import {logger as logFactory, util, env} from '@appium/support';
8
7
  import {asyncify} from 'asyncbox';
@@ -23,7 +22,7 @@ import {
23
22
  } from './config';
24
23
  import {readConfigFile} from './config-file';
25
24
  import {loadExtensions, getActivePlugins, getActiveDrivers} from './extension';
26
- import {SERVER_SUBCOMMAND} from './constants';
25
+ import {SERVER_SUBCOMMAND, LONG_STACKTRACE_LIMIT} from './constants';
27
26
  import registerNode from './grid-register';
28
27
  import {getDefaultsForSchema, validate} from './schema/schema';
29
28
  import {
@@ -47,7 +46,7 @@ async function preflightChecks(args, throwInsteadOfExit = false) {
47
46
  checkNodeOk();
48
47
  await checkNpmOk();
49
48
  if (args.longStacktrace) {
50
- require('longjohn').async_trace_limit = -1;
49
+ Error.stackTraceLimit = LONG_STACKTRACE_LIMIT;
51
50
  }
52
51
  if (args.showBuildInfo) {
53
52
  await showBuildInfo();
@@ -114,17 +113,6 @@ async function logStartupInfo(args) {
114
113
  // }
115
114
  }
116
115
 
117
- /**
118
- * Logs the address and port the server is listening on
119
- * @param {string} address - Address
120
- * @param {number} port - Port
121
- * @returns {void}
122
- */
123
- function logServerPort(address, port) {
124
- let logMessage = `Appium REST http interface listener started on ` + `${address}:${port}`;
125
- logger.info(logMessage);
126
- }
127
-
128
116
  /**
129
117
  * Gets a list of `updateServer` functions from all extensions
130
118
  * @param {DriverNameMap} driverClasses
@@ -245,7 +233,11 @@ async function init(args) {
245
233
  }
246
234
  }
247
235
 
248
- const appiumDriver = new AppiumDriver(serverArgs);
236
+ const appiumDriver = new AppiumDriver(
237
+ /** @type {import('@appium/types').DriverOpts<import('./appium').AppiumDriverConstraints>} */ (
238
+ serverArgs
239
+ )
240
+ );
249
241
  // set the config on the umbrella driver so it can match drivers to caps
250
242
  appiumDriver.driverConfig = driverConfig;
251
243
  await preflightChecks(serverArgs, throwInsteadOfExit);
@@ -371,7 +363,10 @@ async function main(args) {
371
363
  });
372
364
  }
373
365
 
374
- logServerPort(parsedArgs.address, parsedArgs.port);
366
+ logger.info(
367
+ `Appium REST http interface listener started on ${parsedArgs.address}:${parsedArgs.port}${parsedArgs.basePath}`
368
+ );
369
+
375
370
  driverConfig.print();
376
371
  pluginConfig.print([...pluginClasses.values()]);
377
372
 
@@ -224,7 +224,7 @@ export function toParserArgs() {
224
224
  }
225
225
 
226
226
  /**
227
- * @template T
227
+ * @template {string|number} T
228
228
  * @typedef {import('ajv/dist/types').FormatValidator<T>} FormatValidator<T>
229
229
  */
230
230
 
package/lib/utils.js CHANGED
@@ -223,7 +223,8 @@ function adjustNodePath() {
223
223
  // ! statements in client modules. It uses a private API though,
224
224
  // ! so it could break (maybe, eventually).
225
225
  // See https://gist.github.com/branneman/8048520#7-the-hack
226
- // @ts-ignore
226
+ // @ts-ignore see above comment
227
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
227
228
  require('module').Module._initPaths();
228
229
  return true;
229
230
  } catch (e) {
@@ -368,21 +369,18 @@ export {
368
369
  */
369
370
 
370
371
  /**
371
- * @template {Constraints} [C=BaseDriverCapConstraints]
372
- * @template {StringRecord|void} [Extra=void]
373
- * @typedef {import('@appium/types').Capabilities<C, Extra>} Capabilities
372
+ * @template {Constraints} C
373
+ * @typedef {import('@appium/types').Capabilities<C>} Capabilities
374
374
  */
375
375
 
376
376
  /**
377
- * @template {Constraints} [C=BaseDriverCapConstraints]
378
- * @template {StringRecord|void} [Extra=void]
379
- * @typedef {import('@appium/types').W3CCapabilities<C, Extra>} W3CCapabilities
377
+ * @template {Constraints} C
378
+ * @typedef {import('@appium/types').W3CCapabilities<C>} W3CCapabilities
380
379
  */
381
380
 
382
381
  /**
383
- * @template {Constraints} [C=BaseDriverCapConstraints]
384
- * @template {StringRecord|void} [Extra=void]
385
- * @typedef {import('@appium/types').NSCapabilities<C, Extra>} NSCapabilities
382
+ * @template {Constraints} C
383
+ * @typedef {import('@appium/types').NSCapabilities<C>} NSCapabilities
386
384
  */
387
385
 
388
386
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appium",
3
- "version": "2.0.0-beta.57",
3
+ "version": "2.0.0-beta.59",
4
4
  "description": "Automation for Apps.",
5
5
  "keywords": [
6
6
  "automation",
@@ -44,13 +44,14 @@
44
44
  ],
45
45
  "scripts": {
46
46
  "build:docs": "node docs/scripts/build-docs.js",
47
+ "build:docs:preview": "cross-env APPIUM_DOCS_PREVIEW=1 npm run build:docs",
47
48
  "build:docs:assets": "node docs/scripts/copy-assets.js",
48
49
  "build:docs:cli": "node docs/scripts/gen-cli-args-docs.js",
49
50
  "build:docs:reference": "node docs/scripts/build-reference.js",
50
51
  "dev:docs": "npm run build:docs:assets && npm run dev:docs:en",
51
- "dev:docs:en": "mkdocs serve -f ./docs/mkdocs-en.yml",
52
- "dev:docs:ja": "mkdocs serve -f ./docs/mkdocs-ja.yml",
53
- "dev:docs:zh": "mkdocs serve -f ./docs/mkdocs-zh.yml",
52
+ "dev:docs:en": "appium-docs build --serve --mkdocs-yml ./docs/mkdocs-en.yml",
53
+ "dev:docs:ja": "appium-docs build --serve --mkdocs-yml ./docs/mkdocs-ja.yml",
54
+ "dev:docs:zh": "appium-docs build --serve --mkdocs-yml ./docs/mkdocs-zh.yml",
54
55
  "postinstall": "node ./scripts/autoinstall-extensions.js",
55
56
  "publish:docs": "cross-env APPIUM_DOCS_PUBLISH=1 npm run build:docs",
56
57
  "test": "npm run test:unit",
@@ -59,12 +60,12 @@
59
60
  "test:unit": "mocha \"./test/unit/**/*.spec.js\""
60
61
  },
61
62
  "dependencies": {
62
- "@appium/base-driver": "^9.3.3",
63
- "@appium/base-plugin": "^2.2.3",
64
- "@appium/docutils": "^0.3.0",
63
+ "@appium/base-driver": "^9.3.5",
64
+ "@appium/base-plugin": "^2.2.5",
65
+ "@appium/docutils": "^0.3.2",
65
66
  "@appium/schema": "^0.2.6",
66
- "@appium/support": "^3.1.7",
67
- "@appium/types": "^0.10.1",
67
+ "@appium/support": "^3.1.9",
68
+ "@appium/types": "^0.10.3",
68
69
  "@sidvind/better-ajv-errors": "2.1.0",
69
70
  "@types/argparse": "2.0.10",
70
71
  "@types/bluebird": "3.5.38",
@@ -84,15 +85,14 @@
84
85
  "glob": "8.1.0",
85
86
  "lilconfig": "2.1.0",
86
87
  "lodash": "4.17.21",
87
- "longjohn": "0.2.12",
88
88
  "npmlog": "7.0.1",
89
89
  "ora": "5.4.1",
90
- "package-changed": "2.0.0",
90
+ "package-changed": "3.0.0",
91
91
  "resolve-from": "5.0.0",
92
92
  "semver": "7.3.8",
93
93
  "source-map-support": "0.5.21",
94
94
  "teen_process": "2.0.2",
95
- "type-fest": "3.6.1",
95
+ "type-fest": "3.7.2",
96
96
  "winston": "3.8.2",
97
97
  "wrap-ansi": "7.0.0",
98
98
  "yaml": "2.2.1"
@@ -105,7 +105,7 @@
105
105
  "access": "public",
106
106
  "tag": "next"
107
107
  },
108
- "gitHead": "872b924a97c13142bdb8bf4218a4db324f309ce4",
108
+ "gitHead": "a11a6ede3320c0a58aad82fd7fc4c8b8ba75ae95",
109
109
  "typedoc": {
110
110
  "entryPoint": "./lib/main.js"
111
111
  }
@@ -5,17 +5,18 @@
5
5
 
6
6
  import * as ManifestV2 from './base';
7
7
  import * as ManifestV3 from './v3';
8
-
8
+ import * as ManifestV4 from './v4';
9
9
  // add `import * as ManifestV<new-version> from './v<new-version>';` above
10
10
 
11
- export * from './v3';
11
+ export * from './v4';
12
12
  // replace above line with `export * from './v<new-version>';`
13
13
 
14
- export {ManifestV2, ManifestV3};
14
+ export {ManifestV2, ManifestV3, ManifestV4};
15
15
 
16
16
  export interface ManifestDataVersions {
17
17
  2: ManifestV2.ManifestData;
18
18
  3: ManifestV3.ManifestData;
19
+ 4: ManifestV4.ManifestData;
19
20
  }
20
21
  // append to this interface your new version of `ManifestData`
21
22
 
@@ -0,0 +1,161 @@
1
+ import {DriverType, ExtensionType, PluginType} from '@appium/types';
2
+ import {SchemaObject} from 'ajv';
3
+ import {PackageJson, SetRequired} from 'type-fest';
4
+
5
+ /**
6
+ * One of the possible extension installation stratgies
7
+ */
8
+ export type InstallType = 'npm' | 'git' | 'local' | 'github' | 'dev';
9
+
10
+ export interface InternalMetadata {
11
+ /**
12
+ * Package name of extension
13
+ *
14
+ * `name` from its `package.json`
15
+ */
16
+ pkgName: string;
17
+ /**
18
+ * Version of extension
19
+ *
20
+ * `version` from its `package.json`
21
+ */
22
+ version: string;
23
+ /**
24
+ * The method in which the user installed the extension (the `source` CLI arg)
25
+ */
26
+ installType: InstallType;
27
+ /**
28
+ * Whatever the user typed as the extension to install. May be derived from `package.json`
29
+ */
30
+ installSpec: string;
31
+ /**
32
+ * Maximum version of Appium that this extension is compatible with.
33
+ *
34
+ * If `undefined`, we'll try anyway.
35
+ */
36
+ appiumVersion?: string;
37
+ /**
38
+ * Path to the extension's root directory
39
+ */
40
+ installPath: string;
41
+ }
42
+
43
+ /**
44
+ * Shape of the `appium.schema` property in an extension's `package.json` (if it exists)
45
+ */
46
+ export type ExtSchemaMetadata = string | (SchemaObject & {[key: number]: never});
47
+
48
+ /**
49
+ * Manifest data shared by all extensions, as contained in `package.json`
50
+ */
51
+ export interface CommonExtMetadata {
52
+ /**
53
+ * The main class of the extension.
54
+ *
55
+ * The extension must export this class by name.
56
+ */
57
+ mainClass: string;
58
+
59
+ /**
60
+ * Lookup table of scripts to run via `appium <driver|plugin> run <script>` keyed by name.
61
+ */
62
+ scripts?: Record<string, string>;
63
+
64
+ /**
65
+ * Schema describing configuration options (and CLI args) for the extension.
66
+ *
67
+ * Can also just be a path (relative to the extension root) to an external JSON schema file.
68
+ */
69
+ schema?: ExtSchemaMetadata;
70
+ }
71
+
72
+ /**
73
+ * Driver-specific manifest data as stored in a driver's `package.json`
74
+ */
75
+ export interface DriverMetadata {
76
+ /**
77
+ * Automation name of the driver
78
+ */
79
+ automationName: string;
80
+ /**
81
+ * Platforms the driver supports
82
+ */
83
+ platformNames: string[];
84
+ /**
85
+ * Short name of the driver (displayed in `appium list`, etc.)
86
+ */
87
+ driverName: string;
88
+ }
89
+
90
+ /**
91
+ * Plugin-specific manifest data as stored in a plugin's `package.json`
92
+ */
93
+ export interface PluginMetadata {
94
+ /**
95
+ * Short name of the plugin (displayed in `appium list`, etc.)
96
+ */
97
+ pluginName: string;
98
+ }
99
+
100
+ /**
101
+ * Generic extension metadata as stored in the `appium` prop of an extension's `package.json`.
102
+ */
103
+ export type ExtMetadata<ExtType extends ExtensionType> = (ExtType extends DriverType
104
+ ? DriverMetadata
105
+ : ExtType extends PluginType
106
+ ? PluginMetadata
107
+ : never) &
108
+ CommonExtMetadata;
109
+
110
+ /**
111
+ * Combination of external + internal extension data with `driverName`/`pluginName` removed (it becomes a key in an {@linkcode ExtRecord} object).
112
+ * Part of `extensions.yaml`.
113
+ */
114
+ export type ExtManifest<ExtType extends ExtensionType> = Omit<
115
+ ExtMetadata<ExtType>,
116
+ 'driverName' | 'pluginName'
117
+ > &
118
+ InternalMetadata;
119
+
120
+ /**
121
+ * Lookup of extension name to {@linkcode ExtManifest}.
122
+ * @see {ManifestData}
123
+ */
124
+ export type ExtRecord<ExtType extends ExtensionType> = Record<string, ExtManifest<ExtType>>;
125
+
126
+ /**
127
+ * The shape of the `extensions.yaml` file
128
+ */
129
+ export interface ManifestData {
130
+ drivers: ExtRecord<DriverType>;
131
+ plugins: ExtRecord<PluginType>;
132
+ schemaRev: number;
133
+ }
134
+
135
+ /**
136
+ * The name of an installed extension, as it appears in `extensions.yaml`
137
+ * (as a property name under `drivers` or `plugins`)
138
+ */
139
+ export type ExtName<ExtType extends ExtensionType> = keyof ExtRecord<ExtType>;
140
+
141
+ /**
142
+ * A `package.json` containing extension metadata.
143
+ * Must have the following properties:
144
+ * - `name`: the name of the extension
145
+ * - `version`: the version of the extension
146
+ * - `appium`: the metadata for the extension
147
+ * - `peerDependencies.appium`: the maximum compatible version of Appium
148
+ */
149
+ export type ExtPackageJson<ExtType extends ExtensionType> = SetRequired<
150
+ PackageJson,
151
+ 'name' | 'version'
152
+ > & {
153
+ appium: ExtMetadata<ExtType>;
154
+ peerDependencies: {appium: string; [key: string]: string};
155
+ };
156
+
157
+ /**
158
+ * A transient format between installation and insertion of extension metadata into the manifest.
159
+ */
160
+ export type ExtInstallReceipt<ExtType extends ExtensionType> = ExtMetadata<ExtType> &
161
+ InternalMetadata;