appium 2.0.0-beta.56 → 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.
Files changed (85) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +6 -8
  3. package/build/lib/appium.d.ts +43 -35
  4. package/build/lib/appium.d.ts.map +1 -1
  5. package/build/lib/appium.js +38 -30
  6. package/build/lib/appium.js.map +1 -1
  7. package/build/lib/cli/args.d.ts.map +1 -1
  8. package/build/lib/cli/args.js +10 -0
  9. package/build/lib/cli/args.js.map +1 -1
  10. package/build/lib/cli/driver-command.d.ts +7 -7
  11. package/build/lib/cli/driver-command.d.ts.map +1 -1
  12. package/build/lib/cli/driver-command.js +13 -8
  13. package/build/lib/cli/driver-command.js.map +1 -1
  14. package/build/lib/cli/extension-command.d.ts +60 -43
  15. package/build/lib/cli/extension-command.d.ts.map +1 -1
  16. package/build/lib/cli/extension-command.js +133 -65
  17. package/build/lib/cli/extension-command.js.map +1 -1
  18. package/build/lib/cli/extension.d.ts +5 -5
  19. package/build/lib/cli/extension.d.ts.map +1 -1
  20. package/build/lib/cli/extension.js +1 -1
  21. package/build/lib/cli/extension.js.map +1 -1
  22. package/build/lib/cli/plugin-command.d.ts +7 -7
  23. package/build/lib/cli/plugin-command.d.ts.map +1 -1
  24. package/build/lib/cli/plugin-command.js +13 -8
  25. package/build/lib/cli/plugin-command.js.map +1 -1
  26. package/build/lib/config.d.ts +1 -1
  27. package/build/lib/config.d.ts.map +1 -1
  28. package/build/lib/config.js +3 -2
  29. package/build/lib/config.js.map +1 -1
  30. package/build/lib/constants.d.ts +8 -1
  31. package/build/lib/constants.d.ts.map +1 -1
  32. package/build/lib/constants.js +9 -2
  33. package/build/lib/constants.js.map +1 -1
  34. package/build/lib/extension/driver-config.d.ts +6 -6
  35. package/build/lib/extension/driver-config.d.ts.map +1 -1
  36. package/build/lib/extension/driver-config.js +5 -7
  37. package/build/lib/extension/driver-config.js.map +1 -1
  38. package/build/lib/extension/extension-config.d.ts +31 -10
  39. package/build/lib/extension/extension-config.d.ts.map +1 -1
  40. package/build/lib/extension/extension-config.js +44 -24
  41. package/build/lib/extension/extension-config.js.map +1 -1
  42. package/build/lib/extension/manifest-migrations.d.ts.map +1 -1
  43. package/build/lib/extension/manifest-migrations.js +29 -13
  44. package/build/lib/extension/manifest-migrations.js.map +1 -1
  45. package/build/lib/extension/manifest.d.ts +5 -5
  46. package/build/lib/extension/manifest.d.ts.map +1 -1
  47. package/build/lib/extension/manifest.js +19 -12
  48. package/build/lib/extension/manifest.js.map +1 -1
  49. package/build/lib/main.d.ts.map +1 -1
  50. package/build/lib/main.js +3 -3
  51. package/build/lib/main.js.map +1 -1
  52. package/build/lib/schema/cli-args.d.ts +1 -1
  53. package/build/lib/schema/cli-args.d.ts.map +1 -1
  54. package/build/lib/schema/cli-args.js +1 -1
  55. package/build/lib/utils.d.ts +118 -12
  56. package/build/lib/utils.d.ts.map +1 -1
  57. package/build/lib/utils.js +8 -10
  58. package/build/lib/utils.js.map +1 -1
  59. package/build/types/manifest/index.d.ts +4 -2
  60. package/build/types/manifest/index.d.ts.map +1 -1
  61. package/build/types/manifest/index.js +4 -2
  62. package/build/types/manifest/index.js.map +1 -1
  63. package/build/types/manifest/v4.d.ts +139 -0
  64. package/build/types/manifest/v4.d.ts.map +1 -0
  65. package/build/types/manifest/v4.js +3 -0
  66. package/build/types/manifest/v4.js.map +1 -0
  67. package/lib/appium.js +43 -32
  68. package/lib/cli/args.js +10 -0
  69. package/lib/cli/driver-command.js +13 -8
  70. package/lib/cli/extension-command.js +146 -75
  71. package/lib/cli/extension.js +5 -5
  72. package/lib/cli/plugin-command.js +13 -8
  73. package/lib/config.js +3 -2
  74. package/lib/constants.js +9 -1
  75. package/lib/extension/driver-config.js +5 -8
  76. package/lib/extension/extension-config.js +42 -15
  77. package/lib/extension/manifest-migrations.js +31 -15
  78. package/lib/extension/manifest.js +26 -19
  79. package/lib/main.js +7 -4
  80. package/lib/schema/cli-args.js +1 -1
  81. package/lib/utils.js +8 -10
  82. package/package.json +11 -11
  83. package/scripts/autoinstall-extensions.js +23 -0
  84. package/types/manifest/index.ts +4 -3
  85. package/types/manifest/v4.ts +161 -0
@@ -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;