appium 2.0.0-beta.46 → 2.0.0-beta.48

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 (141) hide show
  1. package/README.md +145 -44
  2. package/build/lib/appium.d.ts +3 -103
  3. package/build/lib/appium.d.ts.map +1 -1
  4. package/build/lib/appium.js +679 -549
  5. package/build/lib/appium.js.map +1 -1
  6. package/build/lib/cli/args.js +247 -127
  7. package/build/lib/cli/args.js.map +1 -1
  8. package/build/lib/cli/driver-command.d.ts +24 -5
  9. package/build/lib/cli/driver-command.d.ts.map +1 -1
  10. package/build/lib/cli/driver-command.js +78 -88
  11. package/build/lib/cli/driver-command.js.map +1 -1
  12. package/build/lib/cli/extension-command.d.ts +33 -24
  13. package/build/lib/cli/extension-command.d.ts.map +1 -1
  14. package/build/lib/cli/extension-command.js +729 -512
  15. package/build/lib/cli/extension-command.js.map +1 -1
  16. package/build/lib/cli/extension.d.ts +7 -6
  17. package/build/lib/cli/extension.d.ts.map +1 -1
  18. package/build/lib/cli/extension.js +68 -65
  19. package/build/lib/cli/extension.js.map +1 -1
  20. package/build/lib/cli/parser.d.ts +3 -3
  21. package/build/lib/cli/parser.d.ts.map +1 -1
  22. package/build/lib/cli/parser.js +234 -192
  23. package/build/lib/cli/parser.js.map +1 -1
  24. package/build/lib/cli/plugin-command.js +58 -87
  25. package/build/lib/cli/plugin-command.js.map +1 -1
  26. package/build/lib/cli/utils.js +66 -69
  27. package/build/lib/cli/utils.js.map +1 -1
  28. package/build/lib/config-file.d.ts.map +1 -1
  29. package/build/lib/config-file.js +189 -120
  30. package/build/lib/config-file.js.map +1 -1
  31. package/build/lib/config.d.ts.map +1 -1
  32. package/build/lib/config.js +254 -213
  33. package/build/lib/config.js.map +1 -1
  34. package/build/lib/constants.d.ts +6 -5
  35. package/build/lib/constants.d.ts.map +1 -1
  36. package/build/lib/constants.js +65 -59
  37. package/build/lib/constants.js.map +1 -1
  38. package/build/lib/extension/driver-config.js +199 -164
  39. package/build/lib/extension/driver-config.js.map +1 -1
  40. package/build/lib/extension/extension-config.d.ts +33 -26
  41. package/build/lib/extension/extension-config.d.ts.map +1 -1
  42. package/build/lib/extension/extension-config.js +541 -396
  43. package/build/lib/extension/extension-config.js.map +1 -1
  44. package/build/lib/extension/index.js +98 -68
  45. package/build/lib/extension/index.js.map +1 -1
  46. package/build/lib/extension/manifest-migrations.d.ts +27 -0
  47. package/build/lib/extension/manifest-migrations.d.ts.map +1 -0
  48. package/build/lib/extension/manifest-migrations.js +118 -0
  49. package/build/lib/extension/manifest-migrations.js.map +1 -0
  50. package/build/lib/extension/manifest.d.ts +35 -63
  51. package/build/lib/extension/manifest.d.ts.map +1 -1
  52. package/build/lib/extension/manifest.js +500 -240
  53. package/build/lib/extension/manifest.js.map +1 -1
  54. package/build/lib/extension/package-changed.js +57 -61
  55. package/build/lib/extension/package-changed.js.map +1 -1
  56. package/build/lib/extension/plugin-config.d.ts +2 -3
  57. package/build/lib/extension/plugin-config.d.ts.map +1 -1
  58. package/build/lib/extension/plugin-config.js +94 -70
  59. package/build/lib/extension/plugin-config.js.map +1 -1
  60. package/build/lib/grid-register.js +119 -137
  61. package/build/lib/grid-register.js.map +1 -1
  62. package/build/lib/logger.d.ts +1 -1
  63. package/build/lib/logger.d.ts.map +1 -1
  64. package/build/lib/logger.js +5 -15
  65. package/build/lib/logger.js.map +1 -1
  66. package/build/lib/logsink.d.ts.map +1 -1
  67. package/build/lib/logsink.js +189 -183
  68. package/build/lib/logsink.js.map +1 -1
  69. package/build/lib/main.d.ts +19 -12
  70. package/build/lib/main.d.ts.map +1 -1
  71. package/build/lib/main.js +330 -304
  72. package/build/lib/main.js.map +1 -1
  73. package/build/lib/schema/arg-spec.js +153 -108
  74. package/build/lib/schema/arg-spec.js.map +1 -1
  75. package/build/lib/schema/cli-args.js +203 -164
  76. package/build/lib/schema/cli-args.js.map +1 -1
  77. package/build/lib/schema/cli-transformers.js +117 -72
  78. package/build/lib/schema/cli-transformers.js.map +1 -1
  79. package/build/lib/schema/index.js +17 -32
  80. package/build/lib/schema/index.js.map +1 -1
  81. package/build/lib/schema/keywords.js +125 -67
  82. package/build/lib/schema/keywords.js.map +1 -1
  83. package/build/lib/schema/schema.d.ts.map +1 -1
  84. package/build/lib/schema/schema.js +582 -417
  85. package/build/lib/schema/schema.js.map +1 -1
  86. package/build/lib/utils.d.ts +41 -255
  87. package/build/lib/utils.d.ts.map +1 -1
  88. package/build/lib/utils.js +342 -193
  89. package/build/lib/utils.js.map +1 -1
  90. package/build/tsconfig.tsbuildinfo +1 -1
  91. package/build/types/cli.d.ts +45 -34
  92. package/build/types/cli.d.ts.map +1 -1
  93. package/build/types/cli.js +3 -0
  94. package/build/types/cli.js.map +1 -0
  95. package/build/types/index.d.ts +1 -2
  96. package/build/types/index.d.ts.map +1 -1
  97. package/build/types/index.js +19 -0
  98. package/build/types/index.js.map +1 -0
  99. package/build/types/manifest/base.d.ts +135 -0
  100. package/build/types/manifest/base.d.ts.map +1 -0
  101. package/build/types/manifest/base.js +3 -0
  102. package/build/types/manifest/base.js.map +1 -0
  103. package/build/types/manifest/index.d.ts +19 -0
  104. package/build/types/manifest/index.d.ts.map +1 -0
  105. package/build/types/manifest/index.js +40 -0
  106. package/build/types/manifest/index.js.map +1 -0
  107. package/build/types/manifest/v3.d.ts +139 -0
  108. package/build/types/manifest/v3.d.ts.map +1 -0
  109. package/build/types/manifest/v3.js +3 -0
  110. package/build/types/manifest/v3.js.map +1 -0
  111. package/lib/appium.js +1 -1
  112. package/lib/cli/args.js +1 -1
  113. package/lib/cli/driver-command.js +17 -0
  114. package/lib/cli/extension-command.js +119 -65
  115. package/lib/cli/extension.js +9 -8
  116. package/lib/cli/parser.js +2 -2
  117. package/lib/config-file.js +2 -3
  118. package/lib/config.js +3 -2
  119. package/lib/constants.js +7 -5
  120. package/lib/extension/extension-config.js +52 -47
  121. package/lib/extension/manifest-migrations.js +120 -0
  122. package/lib/extension/manifest.js +184 -103
  123. package/lib/extension/plugin-config.js +1 -2
  124. package/lib/logsink.js +26 -5
  125. package/lib/main.js +58 -50
  126. package/lib/schema/schema.js +6 -1
  127. package/lib/utils.js +62 -0
  128. package/package.json +24 -25
  129. package/scripts/autoinstall-extensions.js +78 -26
  130. package/types/cli.ts +81 -42
  131. package/types/index.ts +1 -2
  132. package/types/manifest/README.md +30 -0
  133. package/types/manifest/base.ts +158 -0
  134. package/types/manifest/index.ts +27 -0
  135. package/types/manifest/v3.ts +161 -0
  136. package/build/types/appium-manifest.d.ts +0 -59
  137. package/build/types/appium-manifest.d.ts.map +0 -1
  138. package/build/types/extension-manifest.d.ts +0 -55
  139. package/build/types/extension-manifest.d.ts.map +0 -1
  140. package/types/appium-manifest.ts +0 -73
  141. package/types/extension-manifest.ts +0 -64
@@ -20,48 +20,6 @@ export class Manifest {
20
20
  * @private
21
21
  */
22
22
  private constructor();
23
- /**
24
- * The entire contents of a parsed YAML extension config file.
25
- *
26
- * Contains proxies for automatic persistence on disk
27
- * @type {ManifestData}
28
- * @private
29
- */
30
- private _data;
31
- /**
32
- * Path to `APPIUM_HOME`.
33
- * @private
34
- * @type {Readonly<string>}
35
- */
36
- private _appiumHome;
37
- /**
38
- * Path to `extensions.yaml`
39
- * @type {string}
40
- * Not set until {@link Manifest.read} is called.
41
- */
42
- _manifestPath: string;
43
- /**
44
- * Helps avoid writing multiple times.
45
- *
46
- * If this is `undefined`, calling {@link Manifest.write} will cause it to be
47
- * set to a `Promise`. When the call to `write()` is complete, the `Promise`
48
- * will resolve and then this value will be set to `undefined`. Concurrent calls
49
- * made while this value is a `Promise` will return the `Promise` itself.
50
- * @private
51
- * @type {Promise<boolean>|undefined}
52
- */
53
- private _writing;
54
- /**
55
- * Helps avoid reading multiple times.
56
- *
57
- * If this is `undefined`, calling {@link Manifest.read} will cause it to be
58
- * set to a `Promise`. When the call to `read()` is complete, the `Promise`
59
- * will resolve and then this value will be set to `undefined`. Concurrent calls
60
- * made while this value is a `Promise` will return the `Promise` itself.
61
- * @private
62
- * @type {Promise<void>|undefined}
63
- */
64
- private _reading;
65
23
  /**
66
24
  * Searches `APPIUM_HOME` for installed extensions and adds them to the manifest.
67
25
  * @returns {Promise<boolean>} `true` if any extensions were added, `false` otherwise.
@@ -82,11 +40,10 @@ export class Manifest {
82
40
  /**
83
41
  * Given a path to a `package.json`, add it as either a driver or plugin to the manifest.
84
42
  *
85
- * Will _not_ overwrite existing entries.
86
43
  * @template {ExtensionType} ExtType
87
44
  * @param {ExtPackageJson<ExtType>} pkgJson
88
45
  * @param {string} pkgPath
89
- * @returns {boolean} - `true` upon success, `false` if the extension is already registered.
46
+ * @returns {boolean} - `true` if this method did anything.
90
47
  */
91
48
  addExtensionFromPackage<ExtType extends import("@appium/types").ExtensionType>(pkgJson: ExtPackageJson<ExtType>, pkgPath: string): boolean;
92
49
  /**
@@ -100,42 +57,56 @@ export class Manifest {
100
57
  * @param {ExtManifest<ExtType>} extData - Extension metadata
101
58
  * @returns {ExtManifest<ExtType>} A clone of `extData`, potentially with a mutated `appiumVersion` field
102
59
  */
103
- addExtension<ExtType_1 extends import("@appium/types").ExtensionType>(extType: ExtType_1, extName: string, extData: ExtManifest<ExtType_1>): ExtManifest<ExtType_1>;
60
+ setExtension<ExtType_1 extends import("@appium/types").ExtensionType>(extType: ExtType_1, extName: string, extData: ExtManifest<ExtType_1>): ExtManifest<ExtType_1>;
61
+ /**
62
+ * Sets the schema revision
63
+ * @param {keyof import('./manifest-migrations').ManifestDataVersions} rev
64
+ */
65
+ setSchemaRev(rev: keyof import('./manifest-migrations').ManifestDataVersions): void;
66
+ /**
67
+ * Remove an extension from the manifest.
68
+ * @param {ExtensionType} extType
69
+ * @param {string} extName
70
+ */
71
+ deleteExtension(extType: ExtensionType, extName: string): void;
104
72
  /**
105
- * Returns the APPIUM_HOME path
73
+ * Returns the `APPIUM_HOME` path
106
74
  */
107
75
  get appiumHome(): string;
108
76
  /**
109
- * Returns the path to the manifest file
77
+ * Returns the path to the manifest file (`extensions.yaml`)
110
78
  */
111
79
  get manifestPath(): string;
80
+ /**
81
+ * Returns the schema rev of this manifest
82
+ */
83
+ get schemaRev(): number;
112
84
  /**
113
85
  * Returns extension data for a particular type.
114
86
  *
115
87
  * @template {ExtensionType} ExtType
116
88
  * @param {ExtType} extType
117
- * @returns {ExtRecord<ExtType>}
89
+ * @returns {Readonly<ExtRecord<ExtType>>}
118
90
  */
119
- getExtensionData<ExtType_2 extends import("@appium/types").ExtensionType>(extType: ExtType_2): ExtRecord<ExtType_2>;
91
+ getExtensionData<ExtType_2 extends import("@appium/types").ExtensionType>(extType: ExtType_2): Readonly<ExtRecord<ExtType_2>>;
120
92
  /**
121
93
  * Reads manifest from disk and _overwrites_ the internal data.
122
94
  *
123
- * If the manifest does not exist on disk, an {@link INITIAL_MANIFEST_DATA "empty"} manifest file will be created.
95
+ * If the manifest does not exist on disk, an
96
+ * {@link INITIAL_MANIFEST_DATA "empty"} manifest file will be created, as
97
+ * well as its directory if needed.
124
98
  *
125
- * If `APPIUM_HOME` contains a `package.json` with an `appium` dependency, then a hash of the `package.json` will be taken. If this hash differs from the last hash, the contents of `APPIUM_HOME/node_modules` will be scanned for extensions that may have been installed outside of the `appium` CLI. Any found extensions will be added to the manifest file, and if so, the manifest file will be written to disk.
99
+ * This will also, if necessary:
100
+ * 1. perform a migration of the manifest data
101
+ * 2. sync the manifest with extensions on-disk (kind of like "auto
102
+ * discovery")
103
+ * 3. write the manifest to disk.
104
+ *
105
+ * Only one read operation can happen at a time.
126
106
  *
127
- * Only one read operation should happen at a time. This is controlled via the {@link Manifest._reading} property.
128
107
  * @returns {Promise<ManifestData>} The data
129
108
  */
130
109
  read(): Promise<ManifestData>;
131
- /**
132
- * Ensures {@link Manifest._manifestPath} is set.
133
- *
134
- * Creates the directory if necessary.
135
- * @private
136
- * @returns {Promise<string>}
137
- */
138
- private _setManifestPath;
139
110
  /**
140
111
  * Writes the data if it need s writing.
141
112
  *
@@ -145,6 +116,7 @@ export class Manifest {
145
116
  * @returns {Promise<boolean>} Whether the data was written
146
117
  */
147
118
  write(): Promise<boolean>;
119
+ #private;
148
120
  }
149
121
  /**
150
122
  * Type of the string referring to a driver (typically as a key or type string)
@@ -162,9 +134,9 @@ export type SyncWithInstalledExtensionsOpts = {
162
134
  };
163
135
  export type ManifestData = import('appium/types').ManifestData;
164
136
  export type InternalMetadata = import('appium/types').InternalMetadata;
165
- export type ExtPackageJson<T> = import('appium/types').ExtPackageJson<T>;
166
- export type ExtManifest<T> = import('appium/types').ExtManifest<T>;
167
- export type ExtRecord<T> = import('appium/types').ExtRecord<T>;
137
+ export type ExtPackageJson<ExtType extends import("@appium/types").ExtensionType> = import('appium/types').ExtPackageJson<ExtType>;
138
+ export type ExtManifest<ExtType extends import("@appium/types").ExtensionType> = import('appium/types').ExtManifest<ExtType>;
139
+ export type ExtRecord<ExtType extends import("@appium/types").ExtensionType> = import('appium/types').ExtRecord<ExtType>;
168
140
  /**
169
141
  * Either `driver` or `plugin` rn
170
142
  */
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../../lib/extension/manifest.js"],"names":[],"mappings":"AAoFA;;;;GAIG;AACH;IA4DE;;;;;;OAMG;IACH,yEAEG;IArBH;;;;;;OAMG;IACH,sBAGC;IAzDD;;;;;;OAMG;IACH,cAAM;IAEN;;;;OAIG;IACH,oBAAY;IAEZ;;;;OAIG;IACH,eAHU,MAAM,CAGF;IAEd;;;;;;;;;OASG;IACH,iBAAS;IAET;;;;;;;;;OASG;IACH,iBAAS;IAyBT;;;OAGG;IACH,+BAFa,QAAQ,OAAO,CAAC,CAqD5B;IAED;;;;OAIG;IACH,gBAHW,MAAM,GACJ,OAAO,CAInB;IAED;;;;OAIG;IACH,gBAHW,MAAM,GACJ,OAAO,CAInB;IAED;;;;;;;;OAQG;IACH,0HAHW,MAAM,GACJ,OAAO,CAuCnB;IAED;;;;;;;;;;OAUG;IACH,mGAJW,MAAM,2DAQhB;IAED;;OAEG;IACH,yBAEC;IAED;;OAEG;IACH,2BAEC;IAED;;;;;;OAMG;IACH,oHAEC;IAED;;;;;;;;;OASG;IACH,QAFa,QAAQ,YAAY,CAAC,CAuDjC;IAED;;;;;;OAMG;IACH,yBAaC;IAED;;;;;;;OAOG;IACH,SAFa,QAAQ,OAAO,CAAC,CAgC5B;CACF;;;;yBAIY,OAAO,eAAe,EAAE,UAAU;;;;yBAKlC,OAAO,eAAe,EAAE,UAAU;;;;;;;2BASlC,OAAO,cAAc,EAAE,YAAY;+BACnC,OAAO,cAAc,EAAE,gBAAgB;gCAKvC,OAAO,cAAc,EAAE,cAAc,CAAC,CAAC,CAAC;6BAKxC,OAAO,cAAc,EAAE,WAAW,CAAC,CAAC,CAAC;2BAKrC,OAAO,cAAc,EAAE,SAAS,CAAC,CAAC,CAAC;;;;4BAKnC,OAAO,eAAe,EAAE,aAAa"}
1
+ {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../../lib/extension/manifest.js"],"names":[],"mappings":"AAqFA;;;;GAIG;AACH;IAwDE;;;;;;OAMG;IACH,yEAEG;IArBH;;;;;;OAMG;IACH,sBAGC;IAaD;;;OAGG;IACH,+BAFa,QAAQ,OAAO,CAAC,CAqE5B;IAED;;;;OAIG;IACH,gBAHW,MAAM,GACJ,OAAO,CAInB;IAED;;;;OAIG;IACH,gBAHW,MAAM,GACJ,OAAO,CAInB;IAED;;;;;;;OAOG;IACH,0HAHW,MAAM,GACJ,OAAO,CA0CnB;IAED;;;;;;;;;;OAUG;IACH,mGAJW,MAAM,2DAQhB;IAED;;;OAGG;IACH,kBAFW,MAAM,OAAO,uBAAuB,EAAE,oBAAoB,QAIpE;IAED;;;;OAIG;IACH,yBAHW,aAAa,WACb,MAAM,QAIhB;IAED;;OAEG;IACH,yBAEC;IAED;;OAEG;IACH,2BAEC;IAED;;OAEG;IACH,wBAEC;IAED;;;;;;OAMG;IACH,8HAEC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,QAFa,QAAQ,YAAY,CAAC,CAwFjC;IAyBD;;;;;;;OAOG;IACH,SAFa,QAAQ,OAAO,CAAC,CAiC5B;;CACF;;;;yBAIY,OAAO,eAAe,EAAE,UAAU;;;;yBAKlC,OAAO,eAAe,EAAE,UAAU;;;;;;;2BASlC,OAAO,cAAc,EAAE,YAAY;+BACnC,OAAO,cAAc,EAAE,gBAAgB;oFAKvC,OAAO,cAAc,EAAE,cAAc,CAAC,OAAO,CAAC;iFAK9C,OAAO,cAAc,EAAE,WAAW,CAAC,OAAO,CAAC;+EAK3C,OAAO,cAAc,EAAE,SAAS,CAAC,OAAO,CAAC;;;;4BAKzC,OAAO,eAAe,EAAE,aAAa"}