appium 2.0.0-beta.57 → 2.0.0-beta.58
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.
- package/README.md +3 -2
- package/build/lib/appium.d.ts +43 -35
- package/build/lib/appium.d.ts.map +1 -1
- package/build/lib/appium.js +37 -29
- package/build/lib/appium.js.map +1 -1
- package/build/lib/cli/args.d.ts.map +1 -1
- package/build/lib/cli/args.js +10 -0
- package/build/lib/cli/args.js.map +1 -1
- package/build/lib/cli/driver-command.d.ts +7 -7
- package/build/lib/cli/driver-command.js +7 -7
- package/build/lib/cli/driver-command.js.map +1 -1
- package/build/lib/cli/extension-command.d.ts +37 -34
- package/build/lib/cli/extension-command.d.ts.map +1 -1
- package/build/lib/cli/extension-command.js +67 -44
- package/build/lib/cli/extension-command.js.map +1 -1
- package/build/lib/cli/extension.d.ts +5 -5
- package/build/lib/cli/extension.d.ts.map +1 -1
- package/build/lib/cli/extension.js +1 -1
- package/build/lib/cli/extension.js.map +1 -1
- package/build/lib/cli/plugin-command.d.ts +7 -7
- package/build/lib/cli/plugin-command.js +7 -7
- package/build/lib/cli/plugin-command.js.map +1 -1
- package/build/lib/constants.d.ts +8 -1
- package/build/lib/constants.d.ts.map +1 -1
- package/build/lib/constants.js +9 -2
- package/build/lib/constants.js.map +1 -1
- package/build/lib/extension/driver-config.d.ts +6 -6
- package/build/lib/extension/driver-config.d.ts.map +1 -1
- package/build/lib/extension/driver-config.js +5 -7
- package/build/lib/extension/driver-config.js.map +1 -1
- package/build/lib/extension/extension-config.d.ts +31 -10
- package/build/lib/extension/extension-config.d.ts.map +1 -1
- package/build/lib/extension/extension-config.js +44 -24
- package/build/lib/extension/extension-config.js.map +1 -1
- package/build/lib/extension/manifest-migrations.d.ts.map +1 -1
- package/build/lib/extension/manifest-migrations.js +29 -13
- package/build/lib/extension/manifest-migrations.js.map +1 -1
- package/build/lib/extension/manifest.d.ts +5 -5
- package/build/lib/extension/manifest.d.ts.map +1 -1
- package/build/lib/extension/manifest.js +19 -12
- package/build/lib/extension/manifest.js.map +1 -1
- package/build/lib/main.d.ts.map +1 -1
- package/build/lib/main.js +3 -3
- package/build/lib/main.js.map +1 -1
- package/build/lib/schema/cli-args.d.ts +1 -1
- package/build/lib/schema/cli-args.d.ts.map +1 -1
- package/build/lib/schema/cli-args.js +1 -1
- package/build/lib/utils.d.ts +118 -12
- package/build/lib/utils.d.ts.map +1 -1
- package/build/lib/utils.js +8 -10
- package/build/lib/utils.js.map +1 -1
- package/build/types/manifest/index.d.ts +4 -2
- package/build/types/manifest/index.d.ts.map +1 -1
- package/build/types/manifest/index.js +4 -2
- package/build/types/manifest/index.js.map +1 -1
- package/build/types/manifest/v4.d.ts +139 -0
- package/build/types/manifest/v4.d.ts.map +1 -0
- package/build/types/manifest/v4.js +3 -0
- package/build/types/manifest/v4.js.map +1 -0
- package/lib/appium.js +42 -31
- package/lib/cli/args.js +10 -0
- package/lib/cli/driver-command.js +7 -7
- package/lib/cli/extension-command.js +76 -54
- package/lib/cli/extension.js +5 -5
- package/lib/cli/plugin-command.js +7 -7
- package/lib/constants.js +9 -1
- package/lib/extension/driver-config.js +5 -8
- package/lib/extension/extension-config.js +42 -15
- package/lib/extension/manifest-migrations.js +31 -15
- package/lib/extension/manifest.js +26 -19
- package/lib/main.js +7 -4
- package/lib/schema/cli-args.js +1 -1
- package/lib/utils.js +8 -10
- package/package.json +9 -9
- package/types/manifest/index.ts +4 -3
- 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(
|
|
155
|
-
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
49
|
+
Error.stackTraceLimit = LONG_STACKTRACE_LIMIT;
|
|
51
50
|
}
|
|
52
51
|
if (args.showBuildInfo) {
|
|
53
52
|
await showBuildInfo();
|
|
@@ -245,7 +244,11 @@ async function init(args) {
|
|
|
245
244
|
}
|
|
246
245
|
}
|
|
247
246
|
|
|
248
|
-
const appiumDriver = new AppiumDriver(
|
|
247
|
+
const appiumDriver = new AppiumDriver(
|
|
248
|
+
/** @type {import('@appium/types').DriverOpts<import('./appium').AppiumDriverConstraints>} */ (
|
|
249
|
+
serverArgs
|
|
250
|
+
)
|
|
251
|
+
);
|
|
249
252
|
// set the config on the umbrella driver so it can match drivers to caps
|
|
250
253
|
appiumDriver.driverConfig = driverConfig;
|
|
251
254
|
await preflightChecks(serverArgs, throwInsteadOfExit);
|
package/lib/schema/cli-args.js
CHANGED
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}
|
|
372
|
-
* @
|
|
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}
|
|
378
|
-
* @
|
|
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}
|
|
384
|
-
* @
|
|
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.
|
|
3
|
+
"version": "2.0.0-beta.58",
|
|
4
4
|
"description": "Automation for Apps.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"automation",
|
|
@@ -44,6 +44,7 @@
|
|
|
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",
|
|
@@ -59,12 +60,12 @@
|
|
|
59
60
|
"test:unit": "mocha \"./test/unit/**/*.spec.js\""
|
|
60
61
|
},
|
|
61
62
|
"dependencies": {
|
|
62
|
-
"@appium/base-driver": "^9.3.
|
|
63
|
-
"@appium/base-plugin": "^2.2.
|
|
64
|
-
"@appium/docutils": "^0.3.
|
|
63
|
+
"@appium/base-driver": "^9.3.4",
|
|
64
|
+
"@appium/base-plugin": "^2.2.4",
|
|
65
|
+
"@appium/docutils": "^0.3.1",
|
|
65
66
|
"@appium/schema": "^0.2.6",
|
|
66
|
-
"@appium/support": "^3.1.
|
|
67
|
-
"@appium/types": "^0.10.
|
|
67
|
+
"@appium/support": "^3.1.8",
|
|
68
|
+
"@appium/types": "^0.10.2",
|
|
68
69
|
"@sidvind/better-ajv-errors": "2.1.0",
|
|
69
70
|
"@types/argparse": "2.0.10",
|
|
70
71
|
"@types/bluebird": "3.5.38",
|
|
@@ -84,7 +85,6 @@
|
|
|
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
90
|
"package-changed": "2.0.0",
|
|
@@ -92,7 +92,7 @@
|
|
|
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.
|
|
95
|
+
"type-fest": "3.7.1",
|
|
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": "
|
|
108
|
+
"gitHead": "d514ebdd7ebd27bb236509d0a3d580f0f18a34e5",
|
|
109
109
|
"typedoc": {
|
|
110
110
|
"entryPoint": "./lib/main.js"
|
|
111
111
|
}
|
package/types/manifest/index.ts
CHANGED
|
@@ -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 './
|
|
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;
|