appium 2.0.0-beta.6 → 2.0.0-beta.61
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/LICENSE +1 -1
- package/README.md +156 -65
- package/build/lib/appium.d.ts +229 -0
- package/build/lib/appium.d.ts.map +1 -0
- package/build/lib/appium.js +678 -439
- package/build/lib/appium.js.map +1 -0
- package/build/lib/cli/args.d.ts +17 -0
- package/build/lib/cli/args.d.ts.map +1 -0
- package/build/lib/cli/args.js +263 -319
- package/build/lib/cli/args.js.map +1 -0
- package/build/lib/cli/driver-command.d.ts +102 -0
- package/build/lib/cli/driver-command.d.ts.map +1 -0
- package/build/lib/cli/driver-command.js +131 -81
- package/build/lib/cli/driver-command.js.map +1 -0
- package/build/lib/cli/extension-command.d.ts +402 -0
- package/build/lib/cli/extension-command.d.ts.map +1 -0
- package/build/lib/cli/extension-command.js +799 -383
- package/build/lib/cli/extension-command.js.map +1 -0
- package/build/lib/cli/extension.d.ts +23 -0
- package/build/lib/cli/extension.d.ts.map +1 -0
- package/build/lib/cli/extension.js +71 -54
- package/build/lib/cli/extension.js.map +1 -0
- package/build/lib/cli/parser.d.ts +84 -0
- package/build/lib/cli/parser.d.ts.map +1 -0
- package/build/lib/cli/parser.js +240 -128
- package/build/lib/cli/parser.js.map +1 -0
- package/build/lib/cli/plugin-command.d.ts +99 -0
- package/build/lib/cli/plugin-command.d.ts.map +1 -0
- package/build/lib/cli/plugin-command.js +125 -81
- package/build/lib/cli/plugin-command.js.map +1 -0
- package/build/lib/cli/utils.d.ts +29 -0
- package/build/lib/cli/utils.d.ts.map +1 -0
- package/build/lib/cli/utils.js +72 -51
- package/build/lib/cli/utils.js.map +1 -0
- package/build/lib/config-file.d.ts +100 -0
- package/build/lib/config-file.d.ts.map +1 -0
- package/build/lib/config-file.js +207 -0
- package/build/lib/config-file.js.map +1 -0
- package/build/lib/config.d.ts +49 -0
- package/build/lib/config.d.ts.map +1 -0
- package/build/lib/config.js +267 -202
- package/build/lib/config.js.map +1 -0
- package/build/lib/constants.d.ts +56 -0
- package/build/lib/constants.d.ts.map +1 -0
- package/build/lib/constants.js +73 -0
- package/build/lib/constants.js.map +1 -0
- package/build/lib/extension/driver-config.d.ts +82 -0
- package/build/lib/extension/driver-config.d.ts.map +1 -0
- package/build/lib/extension/driver-config.js +210 -0
- package/build/lib/extension/driver-config.js.map +1 -0
- package/build/lib/extension/extension-config.d.ts +270 -0
- package/build/lib/extension/extension-config.d.ts.map +1 -0
- package/build/lib/extension/extension-config.js +601 -0
- package/build/lib/extension/extension-config.js.map +1 -0
- package/build/lib/extension/index.d.ts +48 -0
- package/build/lib/extension/index.d.ts.map +1 -0
- package/build/lib/extension/index.js +105 -0
- package/build/lib/extension/index.js.map +1 -0
- package/build/lib/extension/manifest-migrations.d.ts +27 -0
- package/build/lib/extension/manifest-migrations.d.ts.map +1 -0
- package/build/lib/extension/manifest-migrations.js +134 -0
- package/build/lib/extension/manifest-migrations.js.map +1 -0
- package/build/lib/extension/manifest.d.ts +145 -0
- package/build/lib/extension/manifest.d.ts.map +1 -0
- package/build/lib/extension/manifest.js +528 -0
- package/build/lib/extension/manifest.js.map +1 -0
- package/build/lib/extension/package-changed.d.ts +11 -0
- package/build/lib/extension/package-changed.d.ts.map +1 -0
- package/build/lib/extension/package-changed.js +62 -0
- package/build/lib/extension/package-changed.js.map +1 -0
- package/build/lib/extension/plugin-config.d.ts +56 -0
- package/build/lib/extension/plugin-config.d.ts.map +1 -0
- package/build/lib/extension/plugin-config.js +102 -0
- package/build/lib/extension/plugin-config.js.map +1 -0
- package/build/lib/grid-register.d.ts +10 -0
- package/build/lib/grid-register.d.ts.map +1 -0
- package/build/lib/grid-register.js +122 -144
- package/build/lib/grid-register.js.map +1 -0
- package/build/lib/logger.d.ts +3 -0
- package/build/lib/logger.d.ts.map +1 -0
- package/build/lib/logger.js +5 -17
- package/build/lib/logger.js.map +1 -0
- package/build/lib/logsink.d.ts +4 -0
- package/build/lib/logsink.d.ts.map +1 -0
- package/build/lib/logsink.js +190 -187
- package/build/lib/logsink.js.map +1 -0
- package/build/lib/main.d.ts +62 -0
- package/build/lib/main.d.ts.map +1 -0
- package/build/lib/main.js +339 -229
- package/build/lib/main.js.map +1 -0
- package/build/lib/schema/arg-spec.d.ts +143 -0
- package/build/lib/schema/arg-spec.d.ts.map +1 -0
- package/build/lib/schema/arg-spec.js +164 -0
- package/build/lib/schema/arg-spec.js.map +1 -0
- package/build/lib/schema/cli-args.d.ts +19 -0
- package/build/lib/schema/cli-args.d.ts.map +1 -0
- package/build/lib/schema/cli-args.js +217 -0
- package/build/lib/schema/cli-args.js.map +1 -0
- package/build/lib/schema/cli-transformers.d.ts +5 -0
- package/build/lib/schema/cli-transformers.d.ts.map +1 -0
- package/build/lib/schema/cli-transformers.js +124 -0
- package/build/lib/schema/cli-transformers.js.map +1 -0
- package/build/lib/schema/index.d.ts +3 -0
- package/build/lib/schema/index.d.ts.map +1 -0
- package/build/lib/schema/index.js +19 -0
- package/build/lib/schema/index.js.map +1 -0
- package/build/lib/schema/keywords.d.ts +24 -0
- package/build/lib/schema/keywords.d.ts.map +1 -0
- package/build/lib/schema/keywords.js +128 -0
- package/build/lib/schema/keywords.js.map +1 -0
- package/build/lib/schema/schema.d.ts +260 -0
- package/build/lib/schema/schema.d.ts.map +1 -0
- package/build/lib/schema/schema.js +640 -0
- package/build/lib/schema/schema.js.map +1 -0
- package/build/lib/utils.d.ts +266 -0
- package/build/lib/utils.d.ts.map +1 -0
- package/build/lib/utils.js +349 -273
- package/build/lib/utils.js.map +1 -0
- package/build/types/cli.d.ts +134 -0
- package/build/types/cli.d.ts.map +1 -0
- package/build/types/cli.js +3 -0
- package/build/types/cli.js.map +1 -0
- package/build/types/index.d.ts +15 -0
- package/build/types/index.d.ts.map +1 -0
- package/build/types/index.js +19 -0
- package/build/types/index.js.map +1 -0
- package/build/types/manifest/base.d.ts +135 -0
- package/build/types/manifest/base.d.ts.map +1 -0
- package/build/types/manifest/base.js +3 -0
- package/build/types/manifest/base.js.map +1 -0
- package/build/types/manifest/index.d.ts +21 -0
- package/build/types/manifest/index.d.ts.map +1 -0
- package/build/types/manifest/index.js +42 -0
- package/build/types/manifest/index.js.map +1 -0
- package/build/types/manifest/v3.d.ts +139 -0
- package/build/types/manifest/v3.d.ts.map +1 -0
- package/build/types/manifest/v3.js +3 -0
- package/build/types/manifest/v3.js.map +1 -0
- 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/driver.d.ts +1 -0
- package/driver.js +14 -0
- package/index.js +11 -0
- package/lib/appium.js +558 -186
- package/lib/cli/args.js +277 -422
- package/lib/cli/driver-command.js +132 -24
- package/lib/cli/extension-command.js +751 -272
- package/lib/cli/extension.js +49 -18
- package/lib/cli/parser.js +263 -83
- package/lib/cli/plugin-command.js +122 -22
- package/lib/cli/utils.js +24 -10
- package/lib/config-file.js +220 -0
- package/lib/config.js +246 -111
- package/lib/constants.js +79 -0
- package/lib/extension/driver-config.js +247 -0
- package/lib/extension/extension-config.js +709 -0
- package/lib/extension/index.js +116 -0
- package/lib/extension/manifest-migrations.js +136 -0
- package/lib/extension/manifest.js +580 -0
- package/lib/extension/package-changed.js +64 -0
- package/lib/extension/plugin-config.js +112 -0
- package/lib/grid-register.js +49 -35
- package/lib/logger.js +1 -2
- package/lib/logsink.js +64 -38
- package/lib/main.js +318 -103
- package/lib/schema/arg-spec.js +229 -0
- package/lib/schema/cli-args.js +238 -0
- package/lib/schema/cli-transformers.js +119 -0
- package/lib/schema/index.js +2 -0
- package/lib/schema/keywords.js +136 -0
- package/lib/schema/schema.js +725 -0
- package/lib/utils.js +289 -167
- package/package.json +84 -84
- package/plugin.d.ts +1 -0
- package/plugin.js +13 -0
- package/scripts/autoinstall-extensions.js +243 -0
- package/support.d.ts +1 -0
- package/support.js +13 -0
- package/tsconfig.json +25 -0
- package/types/cli.ts +193 -0
- package/types/index.ts +20 -0
- package/types/manifest/README.md +30 -0
- package/types/manifest/base.ts +158 -0
- package/types/manifest/index.ts +28 -0
- package/types/manifest/v3.ts +161 -0
- package/types/manifest/v4.ts +161 -0
- package/CHANGELOG.md +0 -3515
- package/bin/ios-webkit-debug-proxy-launcher.js +0 -71
- package/build/lib/cli/npm.js +0 -208
- package/build/lib/cli/parser-helpers.js +0 -82
- package/build/lib/driver-config.js +0 -77
- package/build/lib/drivers.js +0 -96
- package/build/lib/extension-config.js +0 -253
- package/build/lib/plugin-config.js +0 -59
- package/build/lib/plugins.js +0 -14
- package/lib/cli/npm.js +0 -184
- package/lib/cli/parser-helpers.js +0 -79
- package/lib/driver-config.js +0 -46
- package/lib/drivers.js +0 -81
- package/lib/extension-config.js +0 -209
- package/lib/plugin-config.js +0 -34
- package/lib/plugins.js +0 -10
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.LONG_STACKTRACE_LIMIT = exports.CURRENT_SCHEMA_REV = exports.EXT_SUBCOMMAND_RUN = exports.EXT_SUBCOMMAND_UPDATE = exports.EXT_SUBCOMMAND_UNINSTALL = exports.EXT_SUBCOMMAND_INSTALL = exports.EXT_SUBCOMMAND_LIST = exports.PKG_HASHFILE_RELATIVE_PATH = exports.CACHE_DIR_RELATIVE_PATH = exports.KNOWN_DRIVERS = exports.KNOWN_PLUGINS = exports.USE_ALL_PLUGINS = exports.SERVER_SUBCOMMAND = exports.PLUGIN_TYPE = exports.DRIVER_TYPE = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
/**
|
|
9
|
+
* The name of the extension type for drivers
|
|
10
|
+
*/
|
|
11
|
+
exports.DRIVER_TYPE = 'driver';
|
|
12
|
+
/**
|
|
13
|
+
* The name of the extension type for plugins
|
|
14
|
+
*/
|
|
15
|
+
exports.PLUGIN_TYPE = 'plugin';
|
|
16
|
+
/**
|
|
17
|
+
* The `server` command of the `appium` CLI
|
|
18
|
+
*/
|
|
19
|
+
exports.SERVER_SUBCOMMAND = 'server';
|
|
20
|
+
/**
|
|
21
|
+
* The value of `--use-plugins` if _all_ plugins should be loaded
|
|
22
|
+
*/
|
|
23
|
+
exports.USE_ALL_PLUGINS = 'all';
|
|
24
|
+
// This is a map of plugin names to npm packages representing those plugins.
|
|
25
|
+
// The plugins in this list will be available to the CLI so users can just
|
|
26
|
+
// type 'appium plugin install 'name'', rather than having to specify the full
|
|
27
|
+
// npm package. I.e., these are the officially recognized plugins.
|
|
28
|
+
exports.KNOWN_PLUGINS = Object.freeze(
|
|
29
|
+
/** @type {const} */ ({
|
|
30
|
+
images: '@appium/images-plugin',
|
|
31
|
+
'execute-driver': '@appium/execute-driver-plugin',
|
|
32
|
+
'relaxed-caps': '@appium/relaxed-caps-plugin',
|
|
33
|
+
'universal-xml': '@appium/universal-xml-plugin',
|
|
34
|
+
}));
|
|
35
|
+
// This is a map of driver names to npm packages representing those drivers.
|
|
36
|
+
// The drivers in this list will be available to the CLI so users can just
|
|
37
|
+
// type 'appium driver install 'name'', rather than having to specify the full
|
|
38
|
+
// npm package. I.e., these are the officially recognized drivers.
|
|
39
|
+
exports.KNOWN_DRIVERS = Object.freeze(
|
|
40
|
+
/** @type {const} */ ({
|
|
41
|
+
uiautomator2: 'appium-uiautomator2-driver',
|
|
42
|
+
xcuitest: 'appium-xcuitest-driver',
|
|
43
|
+
mac2: 'appium-mac2-driver',
|
|
44
|
+
espresso: 'appium-espresso-driver',
|
|
45
|
+
safari: 'appium-safari-driver',
|
|
46
|
+
gecko: 'appium-geckodriver',
|
|
47
|
+
chromium: 'appium-chromium-driver',
|
|
48
|
+
}));
|
|
49
|
+
/**
|
|
50
|
+
* Relative path to directory containing any Appium internal files
|
|
51
|
+
*/
|
|
52
|
+
exports.CACHE_DIR_RELATIVE_PATH = path_1.default.join('node_modules', '.cache', 'appium');
|
|
53
|
+
/**
|
|
54
|
+
* Relative path to hashfile (from `APPIUM_HOME`) of consuming project's `package.json` (if it exists)
|
|
55
|
+
*/
|
|
56
|
+
exports.PKG_HASHFILE_RELATIVE_PATH = path_1.default.join(exports.CACHE_DIR_RELATIVE_PATH, 'package.hash');
|
|
57
|
+
exports.EXT_SUBCOMMAND_LIST = 'list';
|
|
58
|
+
exports.EXT_SUBCOMMAND_INSTALL = 'install';
|
|
59
|
+
exports.EXT_SUBCOMMAND_UNINSTALL = 'uninstall';
|
|
60
|
+
exports.EXT_SUBCOMMAND_UPDATE = 'update';
|
|
61
|
+
exports.EXT_SUBCOMMAND_RUN = 'run';
|
|
62
|
+
/**
|
|
63
|
+
* Current revision of the manifest (`extensions.yaml`) schema
|
|
64
|
+
*/
|
|
65
|
+
exports.CURRENT_SCHEMA_REV = 4;
|
|
66
|
+
/**
|
|
67
|
+
* The default number of stack frames to show in a "long" stack trace, when enabled via `--long-stacktrace`
|
|
68
|
+
* @remarks This value may be increased in the future.
|
|
69
|
+
* @privateRemarks A value like `Infinity` may provide to have deleterious effects on
|
|
70
|
+
* memory usage, perf, and/or log output, and higher limits may be difficult to scan.
|
|
71
|
+
*/
|
|
72
|
+
exports.LONG_STACKTRACE_LIMIT = 100;
|
|
73
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../lib/constants.js"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB;;GAEG;AACU,QAAA,WAAW,GAAG,QAAQ,CAAC;AAEpC;;GAEG;AACU,QAAA,WAAW,GAAG,QAAQ,CAAC;AAEpC;;GAEG;AACU,QAAA,iBAAiB,GAAG,QAAQ,CAAC;AAE1C;;GAEG;AACU,QAAA,eAAe,GAAG,KAAK,CAAC;AAErC,4EAA4E;AAC5E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{
|
|
5
|
+
/**
|
|
6
|
+
* A mapping of {@link Manifest} instances to {@link DriverConfig} instances.
|
|
7
|
+
*
|
|
8
|
+
* `Manifest` and `ExtensionConfig` have a one-to-many relationship; each `Manifest` should be associated with a `DriverConfig` and a `PluginConfig`; no more, no less.
|
|
9
|
+
*
|
|
10
|
+
* This variable tracks the `Manifest`-to-`DriverConfig` portion.
|
|
11
|
+
*
|
|
12
|
+
* @type {WeakMap<Manifest,DriverConfig>}
|
|
13
|
+
* @private
|
|
14
|
+
*/
|
|
15
|
+
private static _instances;
|
|
16
|
+
/**
|
|
17
|
+
* Creates a new {@link DriverConfig} instance for a {@link Manifest} instance.
|
|
18
|
+
*
|
|
19
|
+
* @param {Manifest} manifest
|
|
20
|
+
* @throws If `manifest` already associated with a `DriverConfig`
|
|
21
|
+
* @returns {DriverConfig}
|
|
22
|
+
*/
|
|
23
|
+
static create(manifest: Manifest): DriverConfig;
|
|
24
|
+
/**
|
|
25
|
+
* Returns a DriverConfig associated with a Manifest
|
|
26
|
+
* @param {Manifest} manifest
|
|
27
|
+
* @returns {DriverConfig|undefined}
|
|
28
|
+
*/
|
|
29
|
+
static getInstance(manifest: Manifest): DriverConfig | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Call {@link DriverConfig.create} instead.
|
|
32
|
+
* @private
|
|
33
|
+
* @param {import('./manifest').Manifest} manifest - Manifest instance
|
|
34
|
+
*/
|
|
35
|
+
private constructor();
|
|
36
|
+
/**
|
|
37
|
+
* A set of unique automation names used by drivers.
|
|
38
|
+
* @type {Set<string>}
|
|
39
|
+
*/
|
|
40
|
+
knownAutomationNames: Set<string>;
|
|
41
|
+
/**
|
|
42
|
+
* Checks extensions for problems
|
|
43
|
+
*/
|
|
44
|
+
validate(): Promise<import("./extension-config").ExtRecord<"driver">>;
|
|
45
|
+
/**
|
|
46
|
+
* @param {ExtManifest<DriverType>} extData
|
|
47
|
+
* @returns {import('./extension-config').ExtManifestProblem[]}
|
|
48
|
+
*/
|
|
49
|
+
getConfigProblems(extData: ExtManifest<DriverType>): import('./extension-config').ExtManifestProblem[];
|
|
50
|
+
/**
|
|
51
|
+
* Given capabilities, find a matching driver within the config. Load its class and return it along with version and driver name.
|
|
52
|
+
* @template {import('@appium/types').StringRecord} C
|
|
53
|
+
* @param {C} caps
|
|
54
|
+
* @returns {MatchedDriver}
|
|
55
|
+
*/
|
|
56
|
+
findMatchingDriver<C extends import("@appium/types").StringRecord<any>>({ automationName, platformName }: C): MatchedDriver;
|
|
57
|
+
/**
|
|
58
|
+
* Given an automation name and platform name, find a suitable driver and return its extension data.
|
|
59
|
+
* @param {string} matchAutomationName
|
|
60
|
+
* @param {string} matchPlatformName
|
|
61
|
+
* @returns {ExtMetadata<DriverType> & import('appium/types').InternalMetadata & import('appium/types').CommonExtMetadata}
|
|
62
|
+
*/
|
|
63
|
+
_getDriverBySupport(matchAutomationName: string, matchPlatformName: string): ExtMetadata<DriverType> & import('appium/types').InternalMetadata & import('appium/types').CommonExtMetadata;
|
|
64
|
+
}
|
|
65
|
+
export type ExtMetadata<T extends import("@appium/types").ExtensionType> = import('appium/types').ExtMetadata<T>;
|
|
66
|
+
export type ExtManifest<T extends import("@appium/types").ExtensionType> = import('appium/types').ExtManifest<T>;
|
|
67
|
+
export type ExtensionType = import('@appium/types').ExtensionType;
|
|
68
|
+
export type ManifestData = import('appium/types').ManifestData;
|
|
69
|
+
export type DriverType = import('@appium/types').DriverType;
|
|
70
|
+
export type Manifest = import('./manifest').Manifest;
|
|
71
|
+
export type ExtRecord<T extends import("@appium/types").ExtensionType> = import('appium/types').ExtRecord<T>;
|
|
72
|
+
export type ExtName<T extends import("@appium/types").ExtensionType> = import('appium/types').ExtName<T>;
|
|
73
|
+
/**
|
|
74
|
+
* Return value of {@linkcode DriverConfig.findMatchingDriver }
|
|
75
|
+
*/
|
|
76
|
+
export type MatchedDriver = {
|
|
77
|
+
driver: import('@appium/types').DriverClass;
|
|
78
|
+
version: string;
|
|
79
|
+
driverName: string;
|
|
80
|
+
};
|
|
81
|
+
import { ExtensionConfig } from "./extension-config";
|
|
82
|
+
//# sourceMappingURL=driver-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"driver-config.d.ts","sourceRoot":"","sources":["../../../lib/extension/driver-config.js"],"names":[],"mappings":"AAKA;;GAEG;AACH;IAOE;;;;;;;;;OASG;IACH,0BAAkC;IAalC;;;;;;OAMG;IACH,wBAJW,QAAQ,GAEN,YAAY,CAWxB;IAED;;;;OAIG;IACH,6BAHW,QAAQ,GACN,YAAY,GAAC,SAAS,CAIlC;IApCD;;;;OAIG;IACH,sBAIC;IA3BD;;;OAGG;IACH,sBAFU,IAAI,MAAM,CAAC,CAEA;IAoDrB;;OAEG;IACH,sEAGC;IAED;;;OAGG;IACH,2BAHW,YAAY,UAAU,CAAC,GACrB,OAAO,oBAAoB,EAAE,kBAAkB,EAAE,CA+C7D;IAWD;;;;;OAKG;IACH,8GAFa,aAAa,CAuCzB;IAED;;;;;OAKG;IACH,yCAJW,MAAM,qBACN,MAAM,GACJ,YAAY,UAAU,CAAC,GAAG,OAAO,cAAc,EAAE,gBAAgB,GAAG,OAAO,cAAc,EAAE,iBAAiB,CA4BxH;CACF;2EAIY,OAAO,cAAc,EAAE,WAAW,CAAC,CAAC,CAAC;2EAKrC,OAAO,cAAc,EAAE,WAAW,CAAC,CAAC,CAAC;4BAIrC,OAAO,eAAe,EAAE,aAAa;2BACrC,OAAO,cAAc,EAAE,YAAY;yBACnC,OAAO,eAAe,EAAE,UAAU;uBAClC,OAAO,YAAY,EAAE,QAAQ;yEAK7B,OAAO,cAAc,EAAE,SAAS,CAAC,CAAC,CAAC;uEAKnC,OAAO,cAAc,EAAE,OAAO,CAAC,CAAC,CAAC;;;;;YAMhC,OAAO,eAAe,EAAE,WAAW;aACnC,MAAM;gBACN,MAAM"}
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.DriverConfig = void 0;
|
|
7
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
8
|
+
const constants_1 = require("../constants");
|
|
9
|
+
const logger_1 = __importDefault(require("../logger"));
|
|
10
|
+
const extension_config_1 = require("./extension-config");
|
|
11
|
+
/**
|
|
12
|
+
* @extends {ExtensionConfig<DriverType>}
|
|
13
|
+
*/
|
|
14
|
+
class DriverConfig extends extension_config_1.ExtensionConfig {
|
|
15
|
+
/**
|
|
16
|
+
* Call {@link DriverConfig.create} instead.
|
|
17
|
+
* @private
|
|
18
|
+
* @param {import('./manifest').Manifest} manifest - Manifest instance
|
|
19
|
+
*/
|
|
20
|
+
constructor(manifest) {
|
|
21
|
+
super(constants_1.DRIVER_TYPE, manifest);
|
|
22
|
+
this.knownAutomationNames = new Set();
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Creates a new {@link DriverConfig} instance for a {@link Manifest} instance.
|
|
26
|
+
*
|
|
27
|
+
* @param {Manifest} manifest
|
|
28
|
+
* @throws If `manifest` already associated with a `DriverConfig`
|
|
29
|
+
* @returns {DriverConfig}
|
|
30
|
+
*/
|
|
31
|
+
static create(manifest) {
|
|
32
|
+
const instance = new DriverConfig(manifest);
|
|
33
|
+
if (DriverConfig.getInstance(manifest)) {
|
|
34
|
+
throw new Error(`Manifest with APPIUM_HOME ${manifest.appiumHome} already has a DriverConfig; use DriverConfig.getInstance() to retrieve it.`);
|
|
35
|
+
}
|
|
36
|
+
DriverConfig._instances.set(manifest, instance);
|
|
37
|
+
return instance;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Returns a DriverConfig associated with a Manifest
|
|
41
|
+
* @param {Manifest} manifest
|
|
42
|
+
* @returns {DriverConfig|undefined}
|
|
43
|
+
*/
|
|
44
|
+
static getInstance(manifest) {
|
|
45
|
+
return DriverConfig._instances.get(manifest);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Checks extensions for problems
|
|
49
|
+
*/
|
|
50
|
+
async validate() {
|
|
51
|
+
this.knownAutomationNames.clear();
|
|
52
|
+
return await super._validate(this.manifest.getExtensionData(constants_1.DRIVER_TYPE));
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* @param {ExtManifest<DriverType>} extData
|
|
56
|
+
* @returns {import('./extension-config').ExtManifestProblem[]}
|
|
57
|
+
*/
|
|
58
|
+
getConfigProblems(extData) {
|
|
59
|
+
const problems = [];
|
|
60
|
+
const { platformNames, automationName } = extData;
|
|
61
|
+
if (!lodash_1.default.isArray(platformNames)) {
|
|
62
|
+
problems.push({
|
|
63
|
+
err: 'Missing or incorrect supported platformNames list.',
|
|
64
|
+
val: platformNames,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
if (lodash_1.default.isEmpty(platformNames)) {
|
|
69
|
+
problems.push({
|
|
70
|
+
err: 'Empty platformNames list.',
|
|
71
|
+
val: platformNames,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
for (const pName of platformNames) {
|
|
76
|
+
if (!lodash_1.default.isString(pName)) {
|
|
77
|
+
problems.push({
|
|
78
|
+
err: 'Incorrectly formatted platformName.',
|
|
79
|
+
val: pName,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (!lodash_1.default.isString(automationName)) {
|
|
86
|
+
problems.push({
|
|
87
|
+
err: 'Missing or incorrect automationName',
|
|
88
|
+
val: automationName,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
if (this.knownAutomationNames.has(automationName)) {
|
|
92
|
+
problems.push({
|
|
93
|
+
err: 'Multiple drivers claim support for the same automationName',
|
|
94
|
+
val: automationName,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
// should we retain the name at the end of this function, once we've checked there are no problems?
|
|
98
|
+
this.knownAutomationNames.add(automationName);
|
|
99
|
+
return problems;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* @param {ExtName<DriverType>} driverName
|
|
103
|
+
* @param {ExtManifest<DriverType>} extData
|
|
104
|
+
* @returns {string}
|
|
105
|
+
*/
|
|
106
|
+
extensionDesc(driverName, { version, automationName }) {
|
|
107
|
+
return `${driverName}@${version} (automationName '${automationName}')`;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Given capabilities, find a matching driver within the config. Load its class and return it along with version and driver name.
|
|
111
|
+
* @template {import('@appium/types').StringRecord} C
|
|
112
|
+
* @param {C} caps
|
|
113
|
+
* @returns {MatchedDriver}
|
|
114
|
+
*/
|
|
115
|
+
findMatchingDriver({ automationName, platformName }) {
|
|
116
|
+
if (!lodash_1.default.isString(platformName)) {
|
|
117
|
+
throw new Error('You must include a platformName capability');
|
|
118
|
+
}
|
|
119
|
+
if (!lodash_1.default.isString(automationName)) {
|
|
120
|
+
throw new Error('You must include an automationName capability');
|
|
121
|
+
}
|
|
122
|
+
logger_1.default.info(`Attempting to find matching driver for automationName ` +
|
|
123
|
+
`'${automationName}' and platformName '${platformName}'`);
|
|
124
|
+
try {
|
|
125
|
+
const { driverName, mainClass, version } = this._getDriverBySupport(automationName, platformName);
|
|
126
|
+
logger_1.default.info(`The '${driverName}' driver was installed and matched caps.`);
|
|
127
|
+
logger_1.default.info(`Will require it at ${this.getInstallPath(driverName)}`);
|
|
128
|
+
const driver = this.require(driverName);
|
|
129
|
+
if (!driver) {
|
|
130
|
+
throw new Error(`Driver '${driverName}' did not export a class with name '${mainClass}'. Contact the author of the driver!`);
|
|
131
|
+
}
|
|
132
|
+
return { driver, version, driverName };
|
|
133
|
+
}
|
|
134
|
+
catch (err) {
|
|
135
|
+
const msg = `Could not find a driver for automationName ` +
|
|
136
|
+
`'${automationName}' and platformName '${platformName}'. ` +
|
|
137
|
+
`Have you installed a driver that supports those ` +
|
|
138
|
+
`capabilities? Run 'appium driver list --installed' to see. ` +
|
|
139
|
+
`(Lower-level error: ${err.message})`;
|
|
140
|
+
throw new Error(msg);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Given an automation name and platform name, find a suitable driver and return its extension data.
|
|
145
|
+
* @param {string} matchAutomationName
|
|
146
|
+
* @param {string} matchPlatformName
|
|
147
|
+
* @returns {ExtMetadata<DriverType> & import('appium/types').InternalMetadata & import('appium/types').CommonExtMetadata}
|
|
148
|
+
*/
|
|
149
|
+
_getDriverBySupport(matchAutomationName, matchPlatformName) {
|
|
150
|
+
const drivers = this.installedExtensions;
|
|
151
|
+
for (const [driverName, driverData] of lodash_1.default.toPairs(drivers)) {
|
|
152
|
+
const { automationName, platformNames } = driverData;
|
|
153
|
+
const aNameMatches = automationName.toLowerCase() === matchAutomationName.toLowerCase();
|
|
154
|
+
const pNameMatches = lodash_1.default.includes(platformNames.map(lodash_1.default.toLower), matchPlatformName.toLowerCase());
|
|
155
|
+
if (aNameMatches && pNameMatches) {
|
|
156
|
+
return { driverName, ...driverData };
|
|
157
|
+
}
|
|
158
|
+
if (aNameMatches) {
|
|
159
|
+
throw new Error(`Driver '${driverName}' supports automationName ` +
|
|
160
|
+
`'${automationName}', but Appium could not find ` +
|
|
161
|
+
`support for platformName '${matchPlatformName}'. Supported ` +
|
|
162
|
+
`platformNames are: ` +
|
|
163
|
+
JSON.stringify(platformNames));
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
throw new Error(`Could not find installed driver to support given caps`);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
exports.DriverConfig = DriverConfig;
|
|
170
|
+
/**
|
|
171
|
+
* A mapping of {@link Manifest} instances to {@link DriverConfig} instances.
|
|
172
|
+
*
|
|
173
|
+
* `Manifest` and `ExtensionConfig` have a one-to-many relationship; each `Manifest` should be associated with a `DriverConfig` and a `PluginConfig`; no more, no less.
|
|
174
|
+
*
|
|
175
|
+
* This variable tracks the `Manifest`-to-`DriverConfig` portion.
|
|
176
|
+
*
|
|
177
|
+
* @type {WeakMap<Manifest,DriverConfig>}
|
|
178
|
+
* @private
|
|
179
|
+
*/
|
|
180
|
+
DriverConfig._instances = new WeakMap();
|
|
181
|
+
/**
|
|
182
|
+
* @template {ExtensionType} T
|
|
183
|
+
* @typedef {import('appium/types').ExtMetadata<T>} ExtMetadata
|
|
184
|
+
*/
|
|
185
|
+
/**
|
|
186
|
+
* @template {ExtensionType} T
|
|
187
|
+
* @typedef {import('appium/types').ExtManifest<T>} ExtManifest
|
|
188
|
+
*/
|
|
189
|
+
/**
|
|
190
|
+
* @typedef {import('@appium/types').ExtensionType} ExtensionType
|
|
191
|
+
* @typedef {import('appium/types').ManifestData} ManifestData
|
|
192
|
+
* @typedef {import('@appium/types').DriverType} DriverType
|
|
193
|
+
* @typedef {import('./manifest').Manifest} Manifest
|
|
194
|
+
*/
|
|
195
|
+
/**
|
|
196
|
+
* @template {ExtensionType} T
|
|
197
|
+
* @typedef {import('appium/types').ExtRecord<T>} ExtRecord
|
|
198
|
+
*/
|
|
199
|
+
/**
|
|
200
|
+
* @template {ExtensionType} T
|
|
201
|
+
* @typedef {import('appium/types').ExtName<T>} ExtName
|
|
202
|
+
*/
|
|
203
|
+
/**
|
|
204
|
+
* Return value of {@linkcode DriverConfig.findMatchingDriver}
|
|
205
|
+
* @typedef MatchedDriver
|
|
206
|
+
* @property {import('@appium/types').DriverClass} driver
|
|
207
|
+
* @property {string} version
|
|
208
|
+
* @property {string} driverName
|
|
209
|
+
*/
|
|
210
|
+
//# sourceMappingURL=driver-config.js.map
|
|
@@ -0,0 +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;AAC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,KAAK,mBAAmB,CAAC,WAAW,EAAE,CAAC;YACxF,MAAM,YAAY,GAAG,gBAAC,CAAC,QAAQ,CAC7B,aAAa,CAAC,GAAG,CAAC,gBAAC,CAAC,OAAO,CAAC,EAC5B,iBAAiB,CAAC,WAAW,EAAE,CAChC,CAAC;YAEF,IAAI,YAAY,IAAI,YAAY,EAAE;gBAChC,OAAO,EAAC,UAAU,EAAE,GAAG,UAAU,EAAC,CAAC;aACpC;YAED,IAAI,YAAY,EAAE;gBAChB,MAAM,IAAI,KAAK,CACb,WAAW,UAAU,4BAA4B;oBAC/C,IAAI,cAAc,+BAA+B;oBACjD,6BAA6B,iBAAiB,eAAe;oBAC7D,qBAAqB;oBACrB,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,CAChC,CAAC;aACH;SACF;QAED,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;IAC3E,CAAC;;AA1MH,oCA2MC;AApMC;;;;;;;;;GASG;AACI,uBAAU,GAAG,IAAI,OAAO,EAAE,CAAC;AA4LpC;;;GAGG;AAEH;;;GAGG;AAEH;;;;;GAKG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;;;;GAMG"}
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* "npm" install type
|
|
3
|
+
* Used when extension was installed by npm package name
|
|
4
|
+
* @remarks _All_ extensions are installed _by_ `npm`, but only this one means the package name was
|
|
5
|
+
* used to specify it
|
|
6
|
+
*/
|
|
7
|
+
export const INSTALL_TYPE_NPM: "npm";
|
|
8
|
+
/**
|
|
9
|
+
* "local" install type
|
|
10
|
+
* Used when extension was installed from a local path
|
|
11
|
+
*/
|
|
12
|
+
export const INSTALL_TYPE_LOCAL: "local";
|
|
13
|
+
/**
|
|
14
|
+
* "github" install type
|
|
15
|
+
* Used when extension was installed via GitHub URL
|
|
16
|
+
*/
|
|
17
|
+
export const INSTALL_TYPE_GITHUB: "github";
|
|
18
|
+
/**
|
|
19
|
+
* "git" install type
|
|
20
|
+
* Used when extensions was installed via Git URL
|
|
21
|
+
*/
|
|
22
|
+
export const INSTALL_TYPE_GIT: "git";
|
|
23
|
+
/**
|
|
24
|
+
* "dev" install type
|
|
25
|
+
* Used when automatically detected as a working copy
|
|
26
|
+
*/
|
|
27
|
+
export const INSTALL_TYPE_DEV: "dev";
|
|
28
|
+
/** @type {Set<InstallType>} */
|
|
29
|
+
export const INSTALL_TYPES: Set<InstallType>;
|
|
30
|
+
/**
|
|
31
|
+
* This class is abstract. It should not be instantiated directly.
|
|
32
|
+
*
|
|
33
|
+
* Subclasses should provide the generic parameter to implement.
|
|
34
|
+
* @template {ExtensionType} ExtType
|
|
35
|
+
*/
|
|
36
|
+
export class ExtensionConfig<ExtType extends import("@appium/types").ExtensionType> {
|
|
37
|
+
/**
|
|
38
|
+
* Intended to be called by corresponding instance methods of subclass.
|
|
39
|
+
* @private
|
|
40
|
+
* @template {ExtensionType} ExtType
|
|
41
|
+
* @param {string} appiumHome
|
|
42
|
+
* @param {ExtType} extType
|
|
43
|
+
* @param {ExtName<ExtType>} extName - Extension name (unique to its type)
|
|
44
|
+
* @param {ExtManifestWithSchema<ExtType>} extManifest - Extension config
|
|
45
|
+
* @returns {import('ajv').SchemaObject|undefined}
|
|
46
|
+
*/
|
|
47
|
+
private static _readExtensionSchema;
|
|
48
|
+
/**
|
|
49
|
+
* Returns `true` if a specific {@link ExtManifest} object has a `schema` prop.
|
|
50
|
+
* The {@link ExtManifest} object becomes a {@link ExtManifestWithSchema} object.
|
|
51
|
+
* @template {ExtensionType} ExtType
|
|
52
|
+
* @param {ExtManifest<ExtType>} extManifest
|
|
53
|
+
* @returns {extManifest is ExtManifestWithSchema<ExtType>}
|
|
54
|
+
*/
|
|
55
|
+
static extDataHasSchema<ExtType_1 extends import("@appium/types").ExtensionType>(extManifest: ExtManifest<ExtType_1>): extManifest is ExtManifestWithSchema<ExtType_1>;
|
|
56
|
+
/**
|
|
57
|
+
* @protected
|
|
58
|
+
* @param {ExtType} extensionType - Type of extension
|
|
59
|
+
* @param {Manifest} manifest - `Manifest` instance
|
|
60
|
+
*/
|
|
61
|
+
protected constructor();
|
|
62
|
+
/**
|
|
63
|
+
* The type of extension this class is responsible for.
|
|
64
|
+
* @type {ExtType}
|
|
65
|
+
*/
|
|
66
|
+
extensionType: ExtType;
|
|
67
|
+
/**
|
|
68
|
+
* Manifest data for the extensions of this type.
|
|
69
|
+
*
|
|
70
|
+
* This data should _not_ be written to by anything but {@linkcode Manifest}.
|
|
71
|
+
* @type {Readonly<ExtRecord<ExtType>>}
|
|
72
|
+
*/
|
|
73
|
+
installedExtensions: Readonly<ExtRecord<ExtType>>;
|
|
74
|
+
/** @type {import('@appium/types').AppiumLogger} */
|
|
75
|
+
log: import('@appium/types').AppiumLogger;
|
|
76
|
+
/** @type {Manifest} */
|
|
77
|
+
manifest: Manifest;
|
|
78
|
+
get manifestPath(): string;
|
|
79
|
+
get appiumHome(): string;
|
|
80
|
+
/**
|
|
81
|
+
* Returns a list of errors for a given extension.
|
|
82
|
+
*
|
|
83
|
+
* @param {ExtName<ExtType>} extName
|
|
84
|
+
* @param {ExtManifest<ExtType>} extManifest
|
|
85
|
+
* @returns {ExtManifestProblem[]}
|
|
86
|
+
*/
|
|
87
|
+
getProblems(extName: ExtName<ExtType>, extManifest: ExtManifest<ExtType>): ExtManifestProblem[];
|
|
88
|
+
/**
|
|
89
|
+
* Returns a list of warnings for a given extension.
|
|
90
|
+
*
|
|
91
|
+
* @param {ExtName<ExtType>} extName
|
|
92
|
+
* @param {ExtManifest<ExtType>} extManifest
|
|
93
|
+
* @returns {Promise<string[]>}
|
|
94
|
+
*/
|
|
95
|
+
getWarnings(extName: ExtName<ExtType>, extManifest: ExtManifest<ExtType>): Promise<string[]>;
|
|
96
|
+
/**
|
|
97
|
+
* Returns a list of extension-type-specific issues. To be implemented by subclasses.
|
|
98
|
+
* @abstract
|
|
99
|
+
* @param {ExtManifest<ExtType>} extManifest
|
|
100
|
+
* @param {ExtName<ExtType>} extName
|
|
101
|
+
* @returns {Promise<string[]>}
|
|
102
|
+
*/
|
|
103
|
+
getConfigWarnings(extManifest: ExtManifest<ExtType>, extName: ExtName<ExtType>): Promise<string[]>;
|
|
104
|
+
/**
|
|
105
|
+
*
|
|
106
|
+
* @param {Map<ExtName<ExtType>,ExtManifestProblem[]>} [errorMap]
|
|
107
|
+
* @param {Map<ExtName<ExtType>,string[]>} [warningMap]
|
|
108
|
+
*/
|
|
109
|
+
getValidationResultSummaries(errorMap?: Map<string, ExtManifestProblem[]> | undefined, warningMap?: Map<string, string[]> | undefined): {
|
|
110
|
+
errorSummaries: string[];
|
|
111
|
+
warningSummaries: string[];
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Checks extensions for problems. To be called by subclasses' `validate` method.
|
|
115
|
+
*
|
|
116
|
+
* Errors and warnings will be displayed to the user.
|
|
117
|
+
*
|
|
118
|
+
* This method mutates `exts`.
|
|
119
|
+
*
|
|
120
|
+
* @protected
|
|
121
|
+
* @param {ExtRecord<ExtType>} exts - Lookup of extension names to {@linkcode ExtManifest} objects
|
|
122
|
+
* @returns {Promise<ExtRecord<ExtType>>} The same lookup, but picking only error-free extensions
|
|
123
|
+
*/
|
|
124
|
+
protected _validate(exts: ExtRecord<ExtType>): Promise<ExtRecord<ExtType>>;
|
|
125
|
+
/**
|
|
126
|
+
* Retrieves listing data for extensions via command class.
|
|
127
|
+
*
|
|
128
|
+
* This is an expensive operation, so the result is cached. Currently, there is no
|
|
129
|
+
* use case for invalidating the cache.
|
|
130
|
+
* @protected
|
|
131
|
+
* @returns {Promise<import('../cli/extension-command').ExtensionList<ExtType>>}
|
|
132
|
+
*/
|
|
133
|
+
protected getListData(): Promise<import('../cli/extension-command').ExtensionList<ExtType>>;
|
|
134
|
+
/**
|
|
135
|
+
* Returns a list of warnings for a particular extension.
|
|
136
|
+
*
|
|
137
|
+
* By definition, a non-empty list of warnings does _not_ imply the extension cannot be loaded,
|
|
138
|
+
* but it may not work as expected or otherwise throw an exception at runtime.
|
|
139
|
+
*
|
|
140
|
+
* @param {ExtManifest<ExtType>} extManifest
|
|
141
|
+
* @param {ExtName<ExtType>} extName
|
|
142
|
+
* @returns {Promise<string[]>}
|
|
143
|
+
*/
|
|
144
|
+
getGenericConfigWarnings(extManifest: ExtManifest<ExtType>, extName: ExtName<ExtType>): Promise<string[]>;
|
|
145
|
+
/**
|
|
146
|
+
* Returns list of unrecoverable errors (if any) for the given extension _if_ it has a `schema` property.
|
|
147
|
+
*
|
|
148
|
+
* @param {ExtManifest<ExtType>} extManifest - Extension data (from manifest)
|
|
149
|
+
* @param {ExtName<ExtType>} extName - Extension name (from manifest)
|
|
150
|
+
* @returns {ExtManifestProblem[]}
|
|
151
|
+
*/
|
|
152
|
+
getSchemaProblems(extManifest: ExtManifest<ExtType>, extName: ExtName<ExtType>): ExtManifestProblem[];
|
|
153
|
+
/**
|
|
154
|
+
* Return a list of generic unrecoverable errors for the given extension
|
|
155
|
+
* @param {ExtManifest<ExtType>} extManifest - Extension data (from manifest)
|
|
156
|
+
* @param {ExtName<ExtType>} extName - Extension name (from manifest)
|
|
157
|
+
* @returns {ExtManifestProblem[]}
|
|
158
|
+
*/
|
|
159
|
+
getGenericConfigProblems(extManifest: ExtManifest<ExtType>, extName: ExtName<ExtType>): ExtManifestProblem[];
|
|
160
|
+
/**
|
|
161
|
+
* @abstract
|
|
162
|
+
* @param {ExtManifest<ExtType>} extManifest
|
|
163
|
+
* @param {ExtName<ExtType>} extName
|
|
164
|
+
* @returns {ExtManifestProblem[]}
|
|
165
|
+
*/
|
|
166
|
+
getConfigProblems(extManifest: ExtManifest<ExtType>, extName: ExtName<ExtType>): ExtManifestProblem[];
|
|
167
|
+
/**
|
|
168
|
+
* @param {string} extName
|
|
169
|
+
* @param {ExtManifest<ExtType>} extManifest
|
|
170
|
+
* @param {ExtensionConfigMutationOpts} opts
|
|
171
|
+
* @returns {Promise<void>}
|
|
172
|
+
*/
|
|
173
|
+
addExtension(extName: string, extManifest: ExtManifest<ExtType>, { write }?: ExtensionConfigMutationOpts): Promise<void>;
|
|
174
|
+
/**
|
|
175
|
+
* @param {ExtName<ExtType>} extName
|
|
176
|
+
* @param {ExtManifest<ExtType>} extManifest
|
|
177
|
+
* @param {ExtensionConfigMutationOpts} opts
|
|
178
|
+
* @returns {Promise<void>}
|
|
179
|
+
*/
|
|
180
|
+
updateExtension(extName: ExtName<ExtType>, extManifest: ExtManifest<ExtType>, { write }?: ExtensionConfigMutationOpts): Promise<void>;
|
|
181
|
+
/**
|
|
182
|
+
* Remove an extension from the list of installed extensions, and optionally avoid a write to the manifest file.
|
|
183
|
+
*
|
|
184
|
+
* @param {ExtName<ExtType>} extName
|
|
185
|
+
* @param {ExtensionConfigMutationOpts} opts
|
|
186
|
+
* @returns {Promise<void>}
|
|
187
|
+
*/
|
|
188
|
+
removeExtension(extName: ExtName<ExtType>, { write }?: ExtensionConfigMutationOpts): Promise<void>;
|
|
189
|
+
/**
|
|
190
|
+
* @param {ExtName<ExtType>[]} [activeNames]
|
|
191
|
+
* @returns {void}
|
|
192
|
+
*/
|
|
193
|
+
print(activeNames?: string[] | undefined): void;
|
|
194
|
+
/**
|
|
195
|
+
* Returns a string describing the extension. Subclasses must implement.
|
|
196
|
+
* @param {ExtName<ExtType>} extName - Extension name
|
|
197
|
+
* @param {ExtManifest<ExtType>} extManifest - Extension data
|
|
198
|
+
* @returns {string}
|
|
199
|
+
* @abstract
|
|
200
|
+
*/
|
|
201
|
+
extensionDesc(extName: ExtName<ExtType>, extManifest: ExtManifest<ExtType>): string;
|
|
202
|
+
/**
|
|
203
|
+
* Returns--with reasonable accuracy--the path on disk to the extension.
|
|
204
|
+
*
|
|
205
|
+
* If `installPath` is present in the manifest, then it is used; otherwise we just guess.
|
|
206
|
+
* @param {keyof typeof this.installedExtensions} extName
|
|
207
|
+
* @returns {string}
|
|
208
|
+
*/
|
|
209
|
+
getInstallPath(extName: keyof typeof this.installedExtensions): string;
|
|
210
|
+
/**
|
|
211
|
+
* Loads extension and returns its main class (constructor)
|
|
212
|
+
* @param {ExtName<ExtType>} extName
|
|
213
|
+
* @returns {ExtClass<ExtType>}
|
|
214
|
+
*/
|
|
215
|
+
require(extName: ExtName<ExtType>): ExtClass<ExtType>;
|
|
216
|
+
/**
|
|
217
|
+
* @param {string} extName
|
|
218
|
+
* @returns {boolean}
|
|
219
|
+
*/
|
|
220
|
+
isInstalled(extName: string): boolean;
|
|
221
|
+
/**
|
|
222
|
+
* If an extension provides a schema, this will load the schema and attempt to
|
|
223
|
+
* register it with the schema registrar.
|
|
224
|
+
* @param {ExtName<ExtType>} extName - Name of extension
|
|
225
|
+
* @param {ExtManifestWithSchema<ExtType>} extManifest - Extension data
|
|
226
|
+
* @returns {import('ajv').SchemaObject|undefined}
|
|
227
|
+
*/
|
|
228
|
+
readExtensionSchema(extName: ExtName<ExtType>, extManifest: ExtManifestWithSchema<ExtType>): import('ajv').SchemaObject | undefined;
|
|
229
|
+
#private;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* An issue with the {@linkcode ExtManifest } for a particular extension.
|
|
233
|
+
*
|
|
234
|
+
* The existance of such an object implies that the extension cannot be loaded.
|
|
235
|
+
*/
|
|
236
|
+
export type ExtManifestProblem = {
|
|
237
|
+
/**
|
|
238
|
+
* - Error message
|
|
239
|
+
*/
|
|
240
|
+
err: string;
|
|
241
|
+
/**
|
|
242
|
+
* - Associated value
|
|
243
|
+
*/
|
|
244
|
+
val: any;
|
|
245
|
+
};
|
|
246
|
+
/**
|
|
247
|
+
* An optional logging function provided to an {@link ExtensionConfig } subclass.
|
|
248
|
+
*/
|
|
249
|
+
export type ExtensionLogFn = (...args: any[]) => void;
|
|
250
|
+
export type ExtensionType = import('@appium/types').ExtensionType;
|
|
251
|
+
export type Manifest = import('./manifest').Manifest;
|
|
252
|
+
export type InstallType = import('appium/types').InstallType;
|
|
253
|
+
export type ExtManifest<ExtType extends import("@appium/types").ExtensionType> = import('appium/types').ExtManifest<ExtType>;
|
|
254
|
+
export type ExtManifestWithSchema<ExtType extends import("@appium/types").ExtensionType> = ExtManifest<ExtType> & {
|
|
255
|
+
schema: NonNullable<ExtManifest<ExtType>['schema']>;
|
|
256
|
+
};
|
|
257
|
+
export type ExtName<ExtType extends import("@appium/types").ExtensionType> = import('appium/types').ExtName<ExtType>;
|
|
258
|
+
export type ExtClass<ExtType extends import("@appium/types").ExtensionType> = import('appium/types').ExtClass<ExtType>;
|
|
259
|
+
export type ExtRecord<ExtType extends import("@appium/types").ExtensionType> = import('appium/types').ExtRecord<ExtType>;
|
|
260
|
+
export type ExtCommand<ExtType extends import("@appium/types").ExtensionType> = import('../cli/extension').ExtCommand<ExtType>;
|
|
261
|
+
/**
|
|
262
|
+
* Options for various methods in {@link ExtensionConfig }
|
|
263
|
+
*/
|
|
264
|
+
export type ExtensionConfigMutationOpts = {
|
|
265
|
+
/**
|
|
266
|
+
* Whether or not to write the manifest to disk after a mutation operation
|
|
267
|
+
*/
|
|
268
|
+
write?: boolean | undefined;
|
|
269
|
+
};
|
|
270
|
+
//# sourceMappingURL=extension-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extension-config.d.ts","sourceRoot":"","sources":["../../../lib/extension/extension-config.js"],"names":[],"mappings":"AAeA;;;;;GAKG;AACH,qCAAsC;AACtC;;;GAGG;AACH,yCAA0C;AAC1C;;;GAGG;AACH,2CAA4C;AAC5C;;;GAGG;AACH,qCAAsC;AACtC;;;GAGG;AACH,qCAAsC;AAEtC,+BAA+B;AAC/B,4BADW,IAAI,WAAW,CAAC,CAOxB;AAEH;;;;;GAKG;AACH;IAwhBE;;;;;;;;;OASG;IACH,oCAkBC;IAED;;;;;;OAMG;IACH,uKAEC;IAriBD;;;;OAIG;IACH,wBAIC;IAlCD;;;OAGG;IACH,eAFU,OAAO,CAEH;IAEd;;;;;OAKG;IACH,qBAFU,SAAS,UAAU,OAAO,CAAC,CAAC,CAElB;IAEpB,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