appium 2.0.0-beta.5 → 2.0.0-beta.53
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 +156 -63
- package/build/lib/appium.d.ts +226 -0
- package/build/lib/appium.d.ts.map +1 -0
- package/build/lib/appium.js +694 -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 +253 -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 +126 -81
- package/build/lib/cli/driver-command.js.map +1 -0
- package/build/lib/cli/extension-command.d.ts +385 -0
- package/build/lib/cli/extension-command.d.ts.map +1 -0
- package/build/lib/cli/extension-command.js +731 -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 +120 -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 +265 -201
- package/build/lib/config.js.map +1 -0
- package/build/lib/constants.d.ts +49 -0
- package/build/lib/constants.d.ts.map +1 -0
- package/build/lib/constants.js +66 -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 +212 -0
- package/build/lib/extension/driver-config.js.map +1 -0
- package/build/lib/extension/extension-config.d.ts +249 -0
- package/build/lib/extension/extension-config.d.ts.map +1 -0
- package/build/lib/extension/extension-config.js +581 -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 +118 -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 +521 -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 +348 -228
- 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 +259 -0
- package/build/lib/schema/schema.d.ts.map +1 -0
- package/build/lib/schema/schema.js +615 -0
- package/build/lib/schema/schema.js.map +1 -0
- package/build/lib/utils.d.ts +121 -0
- package/build/lib/utils.d.ts.map +1 -0
- package/build/lib/utils.js +351 -273
- package/build/lib/utils.js.map +1 -0
- package/build/tsconfig.tsbuildinfo +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 +19 -0
- package/build/types/manifest/index.d.ts.map +1 -0
- package/build/types/manifest/index.js +40 -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/driver.d.ts +1 -0
- package/driver.js +14 -0
- package/index.js +11 -0
- package/lib/appium.js +535 -186
- package/lib/cli/args.js +267 -422
- package/lib/cli/driver-command.js +126 -23
- package/lib/cli/extension-command.js +679 -271
- package/lib/cli/extension.js +48 -17
- package/lib/cli/parser.js +263 -83
- package/lib/cli/plugin-command.js +115 -20
- package/lib/cli/utils.js +24 -10
- package/lib/config-file.js +220 -0
- package/lib/config.js +244 -110
- package/lib/constants.js +71 -0
- package/lib/extension/driver-config.js +250 -0
- package/lib/extension/extension-config.js +682 -0
- package/lib/extension/index.js +116 -0
- package/lib/extension/manifest-migrations.js +120 -0
- package/lib/extension/manifest.js +573 -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 +321 -101
- 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 +722 -0
- package/lib/utils.js +291 -167
- package/package.json +83 -84
- package/plugin.d.ts +1 -0
- package/plugin.js +13 -0
- package/scripts/autoinstall-extensions.js +237 -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 +27 -0
- package/types/manifest/v3.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
package/types/index.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {ExtensionType, DriverType, DriverClass, PluginType, PluginClass} from '@appium/types';
|
|
2
|
+
|
|
3
|
+
export * from './manifest';
|
|
4
|
+
export * from './cli';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Known environment variables concerning Appium
|
|
8
|
+
*/
|
|
9
|
+
export interface AppiumEnv extends NodeJS.ProcessEnv {
|
|
10
|
+
APPIUM_HOME?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Generic to get at the class of an extension.
|
|
15
|
+
*/
|
|
16
|
+
export type ExtClass<ExtType extends ExtensionType> = ExtType extends DriverType
|
|
17
|
+
? DriverClass
|
|
18
|
+
: ExtType extends PluginType
|
|
19
|
+
? PluginClass
|
|
20
|
+
: never;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# appium-manifest types
|
|
2
|
+
|
|
3
|
+
This dir contains versioned type declarations for our manifest file (`extensions.yaml`).
|
|
4
|
+
|
|
5
|
+
## About
|
|
6
|
+
|
|
7
|
+
Originally, the manifest file was versioned; it had a `schemaRev` prop. Eventually, the requirement for this prop was dropped, and became optional. As of this writing, it is now required again.
|
|
8
|
+
|
|
9
|
+
The idea was that if Appium found an `extensions.yaml` with a `schemaRev` lower than its "current" revision, it would "migrate" the file to the current revision. When we removed the requirement for the `schemaRev` prop, we removed this logic.
|
|
10
|
+
|
|
11
|
+
As of _v3_ of the schema, we are reinstating versioning and migrations.
|
|
12
|
+
|
|
13
|
+
## How To Add A New Version
|
|
14
|
+
|
|
15
|
+
The manifest file types—and thus its format—is composed of types used elsewhere in our codebase. This is probably a design flaw, but the fact remains that the manifest file's format is strongly coupled to Appium's extension-handling logic.
|
|
16
|
+
|
|
17
|
+
For that reason, it is _non-trivial_ to reuse the types declared by older revisions to declare a new revision. If and when someone de-couples the types from the schema, we will have to use the _copy-and-paste_ strategy to create a new version.
|
|
18
|
+
|
|
19
|
+
1. The current version of the schema is defined in `constants.js` as `CURRENT_SCHEMA_REV`. **Increment** this value.
|
|
20
|
+
2. **Copy** the `.ts` file in this directory corresponding to the (now old) current version of the schema into a new file named `v<new-version>.ts`. For example, if the current version is `3`, and you're creating `4`, then you would copy `v3.ts` to `v4.ts`.
|
|
21
|
+
3. **Modify** your new file to do whatever it is you need to do with it. Do _not_ build types upon old versions of the schema.
|
|
22
|
+
4. **Modify** `index.ts`:
|
|
23
|
+
1. **Append** `import * as ManifestV<new-version> from './v<new-version>'`
|
|
24
|
+
2. **Replace** `export * from './v<current-version>'` with `export * from './v<new-version>'`
|
|
25
|
+
3. **Append** `ManifestV<new-version>` to the `export {ManifestV...}` line.
|
|
26
|
+
4. **Append** a key/value pair to `ManifestDataVersions` with the new _numeric_ version number as the key and the value `ManifestV<new-version>.ManifestData`.
|
|
27
|
+
5. **Create** a new `const SCHEMA_REV_<new-version> = <new-version>` in `manifest-migrations.js`.
|
|
28
|
+
6. Finally, **append** a new key/value pair to the `Migrations` object in `manifest-migrations.js`. The key should be a reference to the constant created in step 5, and the value should be a function which performs the migration from the (old) current version to the new version.
|
|
29
|
+
|
|
30
|
+
-- @boneskull, Nov 8 2022
|
|
@@ -0,0 +1,158 @@
|
|
|
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';
|
|
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
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Shape of the `appium.schema` property in an extension's `package.json` (if it exists)
|
|
41
|
+
*/
|
|
42
|
+
export type ExtSchemaMetadata = string | (SchemaObject & {[key: number]: never});
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Manifest data shared by all extensions, as contained in `package.json`
|
|
46
|
+
*/
|
|
47
|
+
export interface CommonExtMetadata {
|
|
48
|
+
/**
|
|
49
|
+
* The main class of the extension.
|
|
50
|
+
*
|
|
51
|
+
* The extension must export this class by name.
|
|
52
|
+
*/
|
|
53
|
+
mainClass: string;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Lookup table of scripts to run via `appium <driver|plugin> run <script>` keyed by name.
|
|
57
|
+
*/
|
|
58
|
+
scripts?: Record<string, string>;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Schema describing configuration options (and CLI args) for the extension.
|
|
62
|
+
*
|
|
63
|
+
* Can also just be a path (relative to the extension root) to an external JSON schema file.
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
schema?: ExtSchemaMetadata;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Driver-specific manifest data as stored in a driver's `package.json`
|
|
71
|
+
*/
|
|
72
|
+
export interface DriverMetadata {
|
|
73
|
+
/**
|
|
74
|
+
* Automation name of the driver
|
|
75
|
+
*/
|
|
76
|
+
automationName: string;
|
|
77
|
+
/**
|
|
78
|
+
* Platforms the driver supports
|
|
79
|
+
*/
|
|
80
|
+
platformNames: string[];
|
|
81
|
+
/**
|
|
82
|
+
* Short name of the driver (displayed in `appium list`, etc.)
|
|
83
|
+
*/
|
|
84
|
+
driverName: string;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Plugin-specific manifest data as stored in a plugin's `package.json`
|
|
89
|
+
*/
|
|
90
|
+
export interface PluginMetadata {
|
|
91
|
+
/**
|
|
92
|
+
* Short name of the plugin (displayed in `appium list`, etc.)
|
|
93
|
+
*/
|
|
94
|
+
pluginName: string;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Generic extension metadata as stored in the `appium` prop of an extension's `package.json`.
|
|
99
|
+
*/
|
|
100
|
+
export type ExtMetadata<ExtType extends ExtensionType> = (ExtType extends DriverType
|
|
101
|
+
? DriverMetadata
|
|
102
|
+
: ExtType extends PluginType
|
|
103
|
+
? PluginMetadata
|
|
104
|
+
: never) &
|
|
105
|
+
CommonExtMetadata;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Combination of external + internal extension data with `driverName`/`pluginName` removed (it becomes a key in an {@linkcode ExtRecord} object).
|
|
109
|
+
* Part of `extensions.yaml`.
|
|
110
|
+
*/
|
|
111
|
+
export type ExtManifest<ExtType extends ExtensionType> = Omit<
|
|
112
|
+
ExtMetadata<ExtType>,
|
|
113
|
+
'driverName' | 'pluginName'
|
|
114
|
+
> &
|
|
115
|
+
InternalMetadata;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Lookup of extension name to {@linkcode ExtManifest}.
|
|
119
|
+
* @see {ManifestData}
|
|
120
|
+
*/
|
|
121
|
+
export type ExtRecord<ExtType extends ExtensionType> = Record<string, ExtManifest<ExtType>>;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* The shape of the `extensions.yaml` file
|
|
125
|
+
*/
|
|
126
|
+
export interface ManifestData {
|
|
127
|
+
drivers: ExtRecord<DriverType>;
|
|
128
|
+
plugins: ExtRecord<PluginType>;
|
|
129
|
+
schemaRev?: number;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* The name of an installed extension, as it appears in `extensions.yaml`
|
|
134
|
+
* (as a property name under `drivers` or `plugins`)
|
|
135
|
+
*/
|
|
136
|
+
export type ExtName<ExtType extends ExtensionType> = keyof ExtRecord<ExtType>;
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* A `package.json` containing extension metadata.
|
|
140
|
+
* Must have the following properties:
|
|
141
|
+
* - `name`: the name of the extension
|
|
142
|
+
* - `version`: the version of the extension
|
|
143
|
+
* - `appium`: the metadata for the extension
|
|
144
|
+
* - `peerDependencies.appium`: the maximum compatible version of Appium
|
|
145
|
+
*/
|
|
146
|
+
export type ExtPackageJson<ExtType extends ExtensionType> = SetRequired<
|
|
147
|
+
PackageJson,
|
|
148
|
+
'name' | 'version'
|
|
149
|
+
> & {
|
|
150
|
+
appium: ExtMetadata<ExtType>;
|
|
151
|
+
peerDependencies: {appium: string; [key: string]: string};
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* A transient format between installation and insertion of extension metadata into the manifest.
|
|
156
|
+
*/
|
|
157
|
+
export type ExtInstallReceipt<ExtType extends ExtensionType> = ExtMetadata<ExtType> &
|
|
158
|
+
InternalMetadata;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* See `README.md` for information on how to add a new version of the schema.
|
|
3
|
+
* @module
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import * as ManifestV2 from './base';
|
|
7
|
+
import * as ManifestV3 from './v3';
|
|
8
|
+
|
|
9
|
+
// add `import * as ManifestV<new-version> from './v<new-version>';` above
|
|
10
|
+
|
|
11
|
+
export * from './v3';
|
|
12
|
+
// replace above line with `export * from './v<new-version>';`
|
|
13
|
+
|
|
14
|
+
export {ManifestV2, ManifestV3};
|
|
15
|
+
|
|
16
|
+
export interface ManifestDataVersions {
|
|
17
|
+
2: ManifestV2.ManifestData;
|
|
18
|
+
3: ManifestV3.ManifestData;
|
|
19
|
+
}
|
|
20
|
+
// append to this interface your new version of `ManifestData`
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* One of the known versions of the `extensions.yaml` schema.
|
|
24
|
+
*
|
|
25
|
+
* @privateRemarks You probably don't need to edit this.
|
|
26
|
+
*/
|
|
27
|
+
export type AnyManifestDataVersion = ManifestDataVersions[keyof ManifestDataVersions];
|
|
@@ -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';
|
|
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;
|