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
@@ -1 +1 @@
1
- {"version":3,"file":"driver-command.js","sourceRoot":"","sources":["../../../lib/cli/driver-command.js"],"names":[],"mappings":";;;;;AAAA,oDAAuB;AACvB,4EAAmD;AACnD,4CAA2C;AAC3C,0BAAwB;AAExB,MAAM,iBAAiB,GAAG,CAAC,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,WAAW,CAAC,CAAC;AAEzF;;GAEG;AAEH,MAAqB,aAAc,SAAQ,2BAAgB;IACzD;;OAEG;IACH,YAAY,EAAC,MAAM,EAAE,IAAI,EAAC;QACxB,KAAK,CAAC,EAAC,MAAM,EAAE,IAAI,EAAC,CAAC,CAAC;QACtB,IAAI,CAAC,eAAe,GAAG,yBAAa,CAAC;IACvC,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,OAAO,CAAC,EAAC,MAAM,EAAE,WAAW,EAAE,WAAW,EAAC;QAC9C,OAAO,MAAM,KAAK,CAAC,QAAQ,CAAC;YAC1B,WAAW,EAAE,MAAM;YACnB,WAAW;YACX,WAAW;SACZ,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,SAAS,CAAC,EAAC,MAAM,EAAC;QACtB,OAAO,MAAM,KAAK,CAAC,UAAU,CAAC,EAAC,WAAW,EAAE,MAAM,EAAC,CAAC,CAAC;IACvD,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,MAAM,CAAC,EAAC,MAAM,EAAE,MAAM,EAAC;QAC3B,OAAO,MAAM,KAAK,CAAC,OAAO,CAAC,EAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAC,CAAC,CAAC;IAC5D,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,GAAG,CAAC,EAAC,MAAM,EAAE,UAAU,EAAE,SAAS,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AAC,KAAK,IAAI;YACrD,oBAAoB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,KAAK,EAAE,CAClE,CAAC;IACJ,CAAC;IAED;;;;;;;;OAQG;IACH,uBAAuB,CAAC,cAAc,EAAE,WAAW;QACjD,MAAM,aAAa,GAAG,iBAAiB,CAAC,MAAM,CAC5C,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,EAAE,KAAK,CAAC,CAAC,EAC/D,EAAE,CACH,CAAC;QAEF,IAAI,CAAC,gBAAC,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE;YAC7B,MAAM,IAAI,KAAK,CACb,WAAW,WAAW,kDAAkD;gBACtE,gCAAgC,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,EAAE,CAClE,CAAC;SACH;IACH,CAAC;CACF;AA5FD,mCA4FC;AAED;;;GAGG;AAEH;;;GAGG;AAEH;;;;GAIG;AAEH;;;;;;GAMG;AAEH;;GAEG;AAEH;;;;GAIG;AAEH;;;;;GAKG;AAEH;;;;;;GAMG"}
@@ -1,6 +1,7 @@
1
- export default ExtensionCommand;
1
+ export default ExtensionCliCommand;
2
+ export { ExtensionCliCommand as ExtensionCommand };
2
3
  /**
3
- * Options for the {@linkcode ExtensionCommand } constructor
4
+ * Options for the {@linkcode ExtensionCliCommand } constructor
4
5
  */
5
6
  export type ExtensionCommandOptions<ExtType extends import("@appium/types").ExtensionType> = {
6
7
  /**
@@ -13,13 +14,17 @@ export type ExtensionCommandOptions<ExtType extends import("@appium/types").Exte
13
14
  json: boolean;
14
15
  };
15
16
  /**
16
- * Extra stuff about extensions; used indirectly by {@linkcode ExtensionCommand.list }.
17
+ * Extra stuff about extensions; used indirectly by {@linkcode ExtensionCliCommand.list }.
17
18
  */
18
- export type ExtensionMetadata = {
19
+ export type ExtensionListMetadata = {
19
20
  /**
20
21
  * - If `true`, the extension is installed
21
22
  */
22
23
  installed: boolean;
24
+ /**
25
+ * - If the extension is installed and the latest
26
+ */
27
+ upToDate: boolean;
23
28
  /**
24
29
  * - If the extension is installed, the version it can be updated to
25
30
  */
@@ -29,13 +34,13 @@ export type ExtensionMetadata = {
29
34
  */
30
35
  unsafeUpdateVersion: string | null;
31
36
  /**
32
- * - If the extension is installed and the latest
37
+ * - Update check error message (if present)
33
38
  */
34
- upToDate: boolean;
39
+ updateError?: string | undefined;
35
40
  /**
36
- * - Update check error message (if present)
41
+ * - If Appium is run from an extension's working copy
37
42
  */
38
- updateError: string | null;
43
+ devMode?: boolean | undefined;
39
44
  };
40
45
  export type ExtensionType = import('@appium/types').ExtensionType;
41
46
  export type DriverType = import('@appium/types').DriverType;
@@ -47,22 +52,16 @@ export type ExtManifest<ExtType extends import("@appium/types").ExtensionType> =
47
52
  export type ExtPackageJson<ExtType extends import("@appium/types").ExtensionType> = import('appium/types').ExtPackageJson<ExtType>;
48
53
  export type ExtInstallReceipt<ExtType extends import("@appium/types").ExtensionType> = import('appium/types').ExtInstallReceipt<ExtType>;
49
54
  /**
50
- * Possible return value for {@linkcode ExtensionCommand.list }
51
- */
52
- export type UninstalledExtensionListData = Partial<InstalledExtensionListData> & {
53
- pkgName: string;
54
- installed: false;
55
- };
56
- /**
57
- * Possible return value for {@linkcode ExtensionCommand.list }
55
+ * Possible return value for {@linkcode ExtensionCliCommand.list }
58
56
  */
59
- export type InstalledExtensionListData = import('appium/types').InternalMetadata & ExtensionMetadata;
57
+ export type ExtensionListData<ExtType extends import("@appium/types").ExtensionType> = Partial<ExtManifest<ExtType>> & Partial<ExtensionListMetadata>;
58
+ export type InstalledExtensionListData<ExtType extends import("@appium/types").ExtensionType> = ExtManifest<ExtType> & ExtensionListMetadata;
60
59
  /**
61
- * Return value of {@linkcode ExtensionCommand.list }.
60
+ * Return value of {@linkcode ExtensionCliCommand.list }.
62
61
  */
63
- export type ExtensionListData = Record<string, InstalledExtensionListData | UninstalledExtensionListData>;
62
+ export type ExtensionList<ExtType extends import("@appium/types").ExtensionType> = Record<string, ExtensionListData<ExtType>>;
64
63
  /**
65
- * Options for {@linkcode ExtensionCommand._run }.
64
+ * Options for {@linkcode ExtensionCliCommand._run }.
66
65
  */
67
66
  export type RunOptions = {
68
67
  /**
@@ -77,9 +76,13 @@ export type RunOptions = {
77
76
  * - arguments to pass to the script
78
77
  */
79
78
  extraArgs?: string[] | undefined;
79
+ /**
80
+ * - if true, will buffer the output of the script and return it
81
+ */
82
+ bufferOutput?: boolean | undefined;
80
83
  };
81
84
  /**
82
- * Return value of {@linkcode ExtensionCommand._run }
85
+ * Return value of {@linkcode ExtensionCliCommand._run }
83
86
  */
84
87
  export type RunOutput = {
85
88
  /**
@@ -87,12 +90,12 @@ export type RunOutput = {
87
90
  */
88
91
  error?: string | undefined;
89
92
  /**
90
- * - script output
93
+ * - script output if `bufferOutput` was `true` in {@linkcode RunOptions }
91
94
  */
92
- output: string[];
95
+ output?: string[] | undefined;
93
96
  };
94
97
  /**
95
- * Options for {@linkcode ExtensionCommand._update }.
98
+ * Options for {@linkcode ExtensionCliCommand._update }.
96
99
  */
97
100
  export type ExtensionUpdateOpts = {
98
101
  /**
@@ -105,7 +108,7 @@ export type ExtensionUpdateOpts = {
105
108
  unsafe: boolean;
106
109
  };
107
110
  /**
108
- * Return value of {@linkcode ExtensionCommand._update }.
111
+ * Return value of {@linkcode ExtensionCliCommand._update }.
109
112
  */
110
113
  export type ExtensionUpdateResult = {
111
114
  /**
@@ -118,7 +121,7 @@ export type ExtensionUpdateResult = {
118
121
  updates: Record<string, UpdateReport>;
119
122
  };
120
123
  /**
121
- * Part of result of {@linkcode ExtensionCommand._update }.
124
+ * Part of result of {@linkcode ExtensionCliCommand._update }.
122
125
  */
123
126
  export type UpdateReport = {
124
127
  /**
@@ -131,7 +134,7 @@ export type UpdateReport = {
131
134
  to: string;
132
135
  };
133
136
  /**
134
- * Options for {@linkcode ExtensionCommand._uninstall }.
137
+ * Options for {@linkcode ExtensionCliCommand._uninstall }.
135
138
  */
136
139
  export type UninstallOpts = {
137
140
  /**
@@ -140,7 +143,7 @@ export type UninstallOpts = {
140
143
  installSpec: string;
141
144
  };
142
145
  /**
143
- * Used by {@linkcode ExtensionCommand.getPostInstallText }
146
+ * Used by {@linkcode ExtensionCliCommand.getPostInstallText }
144
147
  */
145
148
  export type ExtensionArgs = {
146
149
  /**
@@ -153,7 +156,7 @@ export type ExtensionArgs = {
153
156
  extData: object;
154
157
  };
155
158
  /**
156
- * Options for {@linkcode ExtensionCommand.installViaNpm }
159
+ * Options for {@linkcode ExtensionCliCommand.installViaNpm }
157
160
  */
158
161
  export type InstallViaNpmArgs = {
159
162
  /**
@@ -174,7 +177,7 @@ export type InstallViaNpmArgs = {
174
177
  pkgVer?: string | undefined;
175
178
  };
176
179
  /**
177
- * Object returned by {@linkcode ExtensionCommand.checkForExtensionUpdate }
180
+ * Object returned by {@linkcode ExtensionCliCommand.checkForExtensionUpdate }
178
181
  */
179
182
  export type PossibleUpdates = {
180
183
  /**
@@ -191,7 +194,7 @@ export type PossibleUpdates = {
191
194
  unsafeUpdate: string | null;
192
195
  };
193
196
  /**
194
- * Options for {@linkcode ExtensionCommand._install }
197
+ * Options for {@linkcode ExtensionCliCommand._install }
195
198
  */
196
199
  export type InstallOpts = {
197
200
  /**
@@ -217,9 +220,13 @@ export type ListOptions = {
217
220
  * - whether should show available updates
218
221
  */
219
222
  showUpdates: boolean;
223
+ /**
224
+ * - whether to show additional data from the extension
225
+ */
226
+ verbose?: boolean | undefined;
220
227
  };
221
228
  /**
222
- * Opts for {@linkcode ExtensionCommand.getInstallationReceipt }
229
+ * Opts for {@linkcode ExtensionCliCommand.getInstallationReceipt }
223
230
  */
224
231
  export type GetInstallationReceiptOpts<ExtType extends import("@appium/types").ExtensionType> = {
225
232
  installPath: string;
@@ -231,7 +238,7 @@ export type InstallType = import('appium/types').InstallType;
231
238
  /**
232
239
  * @template {ExtensionType} ExtType
233
240
  */
234
- export class ExtensionCommand<ExtType extends import("@appium/types").ExtensionType> {
241
+ declare class ExtensionCliCommand<ExtType extends import("@appium/types").ExtensionType> {
235
242
  /**
236
243
  * Build an ExtensionCommand
237
244
  * @param {ExtensionCommandOptions<ExtType>} opts
@@ -277,11 +284,11 @@ export class ExtensionCommand<ExtType extends import("@appium/types").ExtensionT
277
284
  execute(args: object): Promise<object>;
278
285
  /**
279
286
  * List extensions
280
- *
287
+ * @template {ExtensionType} ExtType
281
288
  * @param {ListOptions} opts
282
- * @return {Promise<ExtensionListData>} map of extension names to extension data
289
+ * @return {Promise<ExtensionList<ExtType>>} map of extension names to extension data
283
290
  */
284
- list({ showInstalled, showUpdates }: ListOptions): Promise<ExtensionListData>;
291
+ list<ExtType_1 extends import("@appium/types").ExtensionType>({ showInstalled, showUpdates, verbose }: ListOptions): Promise<ExtensionList<ExtType_1>>;
285
292
  /**
286
293
  * Install an extension
287
294
  *
@@ -369,17 +376,27 @@ export class ExtensionCommand<ExtType extends import("@appium/types").ExtensionT
369
376
  */
370
377
  updateExtension(installSpec: string, version: string): Promise<void>;
371
378
  /**
372
- * Runs a script cached inside the "scripts" field under "appium"
373
- * inside of the driver/plugins "package.json" file. Will throw
374
- * an error if the driver/plugin does not contain a "scripts" field
375
- * underneath the "appium" field in its package.json, if the
376
- * "scripts" field is not a plain object, or if the scriptName is
377
- * not found within "scripts" object.
379
+ * Just wraps {@linkcode child_process.spawn} with some default options
380
+ *
381
+ * @param {string} cwd - CWD
382
+ * @param {string} script - Path to script
383
+ * @param {string[]} args - Extra args for script
384
+ * @param {import('child_process').SpawnOptions} opts - Options
385
+ * @returns {import('node:child_process').ChildProcess}
386
+ */
387
+ _runUnbuffered(cwd: string, script: string, args?: string[], opts?: import('child_process').SpawnOptions): import('node:child_process').ChildProcess;
388
+ /**
389
+ * Runs a script cached inside the `scripts` field under `appium`
390
+ * inside of the extension's `package.json` file. Will throw
391
+ * an error if the driver/plugin does not contain a `scripts` field
392
+ * underneath the `appium` field in its `package.json`, if the
393
+ * `scripts` field is not a plain object, or if the `scriptName` is
394
+ * not found within `scripts` object.
378
395
  *
379
396
  * @param {RunOptions} opts
380
397
  * @return {Promise<RunOutput>}
381
398
  */
382
- _run({ installSpec, scriptName, extraArgs }: RunOptions): Promise<RunOutput>;
399
+ _run({ installSpec, scriptName, extraArgs, bufferOutput }: RunOptions): Promise<RunOutput>;
383
400
  }
384
401
  import { console } from "@appium/support";
385
402
  //# sourceMappingURL=extension-command.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"extension-command.d.ts","sourceRoot":"","sources":["../../../lib/cli/extension-command.js"],"names":[],"mappings":";;;;;;;;YA4tBc,gBAAgB,OAAO,CAAC;;;;UACxB,OAAO;;;;;;;;;eAOP,OAAO;;;;mBACP,MAAM;;;;yBACN,MAAM;;;;cACN,OAAO;;;;iBACP,MAAM;;4BAIP,OAAO,eAAe,EAAE,aAAa;yBACrC,OAAO,eAAe,EAAE,UAAU;yBAClC,OAAO,eAAe,EAAE,UAAU;+EAKlC,OAAO,cAAc,EAAE,SAAS,CAAC,OAAO,CAAC;qFAKzC,OAAO,+BAA+B,EAAE,eAAe,CAAC,OAAO,CAAC;iFAKhE,OAAO,cAAc,EAAE,WAAW,CAAC,OAAO,CAAC;iFAK3C,OAAO,cAAc,EAAE,WAAW,CAAC,OAAO,CAAC;oFAK3C,OAAO,cAAc,EAAE,cAAc,CAAC,OAAO,CAAC;uFAK9C,OAAO,cAAc,EAAE,iBAAiB,CAAC,OAAO,CAAC;;;;2CAKjD,QAAQ,0BAA0B,CAAC,GAAG;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,KAAK,CAAA;CAAC;;;;yCAKzE,OAAO,cAAc,EAAE,gBAAgB,GAAG,iBAAiB;;;;gCAK3D,OAAO,MAAM,EAAC,0BAA0B,GAAC,4BAA4B,CAAC;;;;;;;;iBAMrE,MAAM;;;;gBACN,MAAM;;;;;;;;;;;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GACf,QAAQ,kBAAkB,OAAO,CAAC,CAAC,CAyB/C;IAED;;;;;;OAMG;IAEH,yBAJW,aAAa,GACX,MAAM,CAKlB;IAED;;;;;OAKG;IACH,uEAHW,2BAA2B,OAAO,CAAC,GACjC,kBAAkB,OAAO,CAAC,CAsBtC;IAED;;;;;;;;;;;OAWG;IACH,yBALW,OAAO,WAAW,EAAE,WAAW,eAC/B,MAAM,kCA8BhB;IAED;;;;;;;OAOG;IAEH,qCAJW,YAAY,OAAO,CAAC,eACpB,MAAM,QAKhB;IAED;;;;;;;;;OASG;IACH,4BAHW,aAAa,GACZ,QAAQ,UAAU,OAAO,CAAC,CAAC,CAatC;IAED;;;;;OAKG;IACH,iCAHW,mBAAmB,GAClB,QAAQ,qBAAqB,CAAC,CA+EzC;IAED;;;;;;OAMG;IACH,6BAHW,MAAM,GACL,QAAQ,eAAe,CAAC,CA4BnC;IAED;;;;;;;OAOG;IACH,6BAJW,MAAM,WACN,MAAM,GACJ,QAAQ,IAAI,CAAC,CAYzB;IAED;;;;;;;;;;OAUG;IACH,6CAHW,UAAU,GACT,QAAQ,SAAS,CAAC,CAoD7B;CACF"}
1
+ {"version":3,"file":"extension-command.d.ts","sourceRoot":"","sources":["../../../lib/cli/extension-command.js"],"names":[],"mappings":";;;;;;;;;YA8xBc,gBAAgB,OAAO,CAAC;;;;UACxB,OAAO;;;;;;;;;eAOP,OAAO;;;;cACP,OAAO;;;;mBACP,MAAM,GAAC,IAAI;;;;yBACX,MAAM,GAAC,IAAI;;;;;;;;;;4BAMZ,OAAO,eAAe,EAAE,aAAa;yBACrC,OAAO,eAAe,EAAE,UAAU;yBAClC,OAAO,eAAe,EAAE,UAAU;+EAKlC,OAAO,cAAc,EAAE,SAAS,CAAC,OAAO,CAAC;qFAKzC,OAAO,+BAA+B,EAAE,eAAe,CAAC,OAAO,CAAC;iFAKhE,OAAO,cAAc,EAAE,WAAW,CAAC,OAAO,CAAC;iFAK3C,OAAO,cAAc,EAAE,WAAW,CAA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IAQX,wBAAmD;IAIrD;;OAEG;IACH,oBAEC;IAED;;;;;;;;;OASG;IACH,qCAJW,MAAM,SAMhB;IAED;;;;;OAKG;IACH,cAHW,MAAM,GACL,QAAQ,MAAM,CAAC,CAS1B;IAED;;;;;OAKG;IACH,uGAHW,WAAW,qCAuHrB;IAED;;;;;OAKG;IACH,oDAHW,WAAW,GACV,QAAQ,UAAU,OAAO,CAAC,CAAC,CA6JtC;IAED;;;;;OAKG;IACH,6DAHW,iBAAiB,GACf,QAAQ,kBAAkB,OAAO,CAAC,CAAC,CAyB/C;IAED;;;;;;OAMG;IAEH,yBAJW,aAAa,GACX,MAAM,CAKlB;IAED;;;;;OAKG;IACH,uEAHW,2BAA2B,OAAO,CAAC,GACjC,kBAAkB,OAAO,CAAC,CAsBtC;IAED;;;;;;;;;;;OAWG;IACH,yBALW,OAAO,WAAW,EAAE,WAAW,eAC/B,MAAM,kCA8BhB;IAED;;;;;;;OAOG;IAEH,qCAJW,YAAY,OAAO,CAAC,eACpB,MAAM,QAKhB;IAED;;;;;;;;;OASG;IACH,4BAHW,aAAa,GACZ,QAAQ,UAAU,OAAO,CAAC,CAAC,CAkBtC;IAED;;;;;OAKG;IACH,iCAHW,mBAAmB,GAClB,QAAQ,qBAAqB,CAAC,CA+EzC;IAED;;;;;;OAMG;IACH,6BAHW,MAAM,GACL,QAAQ,eAAe,CAAC,CA4BnC;IAED;;;;;;;OAOG;IACH,6BAJW,MAAM,WACN,MAAM,GACJ,QAAQ,IAAI,CAAC,CAYzB;IAED;;;;;;;;OAQG;IACH,oBANW,MAAM,UACN,MAAM,SACN,MAAM,EAAE,SACR,OAAO,eAAe,EAAE,YAAY,GAClC,OAAO,oBAAoB,EAAE,YAAY,CAQrD;IAED;;;;;;;;;;OAUG;IACH,2DAHW,UAAU,GACT,QAAQ,SAAS,CAAC,CAkF7B;CACF"}
@@ -10,9 +10,11 @@ const lodash_1 = __importDefault(require("lodash"));
10
10
  const path_1 = __importDefault(require("path"));
11
11
  const support_1 = require("@appium/support");
12
12
  const utils_1 = require("./utils");
13
- const teen_process_1 = require("teen_process");
14
13
  const extension_config_1 = require("../extension/extension-config");
14
+ const teen_process_1 = require("teen_process");
15
15
  const package_changed_1 = require("../extension/package-changed");
16
+ const child_process_1 = require("child_process");
17
+ const node_util_1 = require("node:util");
16
18
  const UPDATE_ALL = 'installed';
17
19
  class NotUpdatableError extends Error {
18
20
  }
@@ -30,7 +32,7 @@ function receiptToManifest(receipt) {
30
32
  /**
31
33
  * @template {ExtensionType} ExtType
32
34
  */
33
- class ExtensionCommand {
35
+ class ExtensionCliCommand {
34
36
  /**
35
37
  * Build an ExtensionCommand
36
38
  * @param {ExtensionCommandOptions<ExtType>} opts
@@ -75,39 +77,40 @@ class ExtensionCommand {
75
77
  }
76
78
  /**
77
79
  * List extensions
78
- *
80
+ * @template {ExtensionType} ExtType
79
81
  * @param {ListOptions} opts
80
- * @return {Promise<ExtensionListData>} map of extension names to extension data
82
+ * @return {Promise<ExtensionList<ExtType>>} map of extension names to extension data
81
83
  */
82
- async list({ showInstalled, showUpdates }) {
83
- const lsMsg = `Listing ${showInstalled ? 'installed' : 'available'} ${this.type}s`;
84
+ async list({ showInstalled, showUpdates, verbose = false }) {
85
+ let lsMsg = `Listing ${showInstalled ? 'installed' : 'available'} ${this.type}s`;
86
+ if (verbose) {
87
+ lsMsg += ' (verbose mode)';
88
+ }
84
89
  const installedNames = Object.keys(this.config.installedExtensions);
85
90
  const knownNames = Object.keys(this.knownExtensions);
86
- const exts = [...installedNames, ...knownNames].reduce((acc, name) => {
91
+ const listData = [...installedNames, ...knownNames].reduce((acc, name) => {
87
92
  if (!acc[name]) {
88
93
  if (installedNames.includes(name)) {
89
94
  acc[name] = {
90
- ...this.config.installedExtensions[name],
95
+ ... /** @type {Partial<ExtManifest<ExtType>>} */(this.config.installedExtensions[name]),
91
96
  installed: true,
92
97
  };
93
98
  }
94
99
  else if (!showInstalled) {
95
- acc[name] = { pkgName: this.knownExtensions[name], installed: false };
100
+ acc[name] = /** @type {ExtensionListData<ExtType>} */ ({
101
+ pkgName: this.knownExtensions[name],
102
+ installed: false,
103
+ });
96
104
  }
97
105
  }
98
106
  return acc;
99
- },
100
- /**
101
- * This accumulator contains either {@linkcode UninstalledExtensionLIstData} _or_
102
- * {@linkcode InstalledExtensionListData} without upgrade information (which is added by the below code block)
103
- * @type {Record<string,Partial<InstalledExtensionListData>|UninstalledExtensionListData>}
104
- */ ({}));
107
+ }, /** @type {ExtensionList<ExtType>} */ ({}));
105
108
  // if we want to show whether updates are available, put that behind a spinner
106
109
  await (0, utils_1.spinWith)(this.isJsonOutput, lsMsg, async () => {
107
110
  if (!showUpdates) {
108
111
  return;
109
112
  }
110
- for (const [ext, data] of lodash_1.default.toPairs(exts)) {
113
+ for (const [ext, data] of lodash_1.default.toPairs(listData)) {
111
114
  if (!data.installed || data.installType !== extension_config_1.INSTALL_TYPE_NPM) {
112
115
  // don't need to check for updates on exts that aren't installed
113
116
  // also don't need to check for updates on non-npm exts
@@ -124,18 +127,27 @@ class ExtensionCommand {
124
127
  }
125
128
  }
126
129
  });
127
- const listData = /** @type {ExtensionListData} */ (exts);
130
+ /**
131
+ * Type guard to narrow "installed" extensions, which have more data
132
+ * @param {any} data
133
+ * @returns {data is InstalledExtensionListData<ExtType>}
134
+ */
135
+ const extIsInstalled = (data) => Boolean(data.installed);
128
136
  // if we're just getting the data, short circuit return here since we don't need to do any
129
137
  // formatting logic
130
138
  if (this.isJsonOutput) {
131
139
  return listData;
132
140
  }
141
+ if (verbose) {
142
+ this.log.log((0, node_util_1.inspect)(listData, { colors: true, depth: null }));
143
+ return listData;
144
+ }
133
145
  for (const [name, data] of lodash_1.default.toPairs(listData)) {
134
146
  let installTxt = ' [not installed]'.grey;
135
147
  let updateTxt = '';
136
148
  let upToDateTxt = '';
137
149
  let unsafeUpdateTxt = '';
138
- if (data.installed) {
150
+ if (extIsInstalled(data)) {
139
151
  const { installType, installSpec, updateVersion, unsafeUpdateVersion, version, upToDate, updateError, } = data;
140
152
  let typeTxt;
141
153
  switch (installType) {
@@ -146,8 +158,11 @@ class ExtensionCommand {
146
158
  case extension_config_1.INSTALL_TYPE_LOCAL:
147
159
  typeTxt = `(linked from ${installSpec})`.magenta;
148
160
  break;
161
+ case extension_config_1.INSTALL_TYPE_DEV:
162
+ typeTxt = '(dev mode)';
163
+ break;
149
164
  default:
150
- typeTxt = '(NPM)';
165
+ typeTxt = '(npm)';
151
166
  }
152
167
  installTxt = `@${version.yellow} ${('[installed ' + typeTxt + ']').green}`;
153
168
  if (showUpdates) {
@@ -433,7 +448,12 @@ class ExtensionCommand {
433
448
  if (!this.config.isInstalled(installSpec)) {
434
449
  throw this._createFatalError(`Can't uninstall ${this.type} '${installSpec}'; it is not installed`);
435
450
  }
436
- const pkgName = this.config.installedExtensions[installSpec].pkgName;
451
+ const extRecord = this.config.installedExtensions[installSpec];
452
+ if (extRecord.installType === extension_config_1.INSTALL_TYPE_DEV) {
453
+ this.log.warn(`Cannot uninstall ${this.type} "${installSpec}" because it is in development!`);
454
+ return this.config.installedExtensions;
455
+ }
456
+ const pkgName = extRecord.pkgName;
437
457
  await support_1.npm.uninstallPackage(this.config.appiumHome, pkgName);
438
458
  await this.config.removeExtension(installSpec);
439
459
  this.log.ok(`Successfully uninstalled ${this.type} '${installSpec}'`.green);
@@ -556,17 +576,33 @@ class ExtensionCommand {
556
576
  await this.config.updateExtension(installSpec, extData);
557
577
  }
558
578
  /**
559
- * Runs a script cached inside the "scripts" field under "appium"
560
- * inside of the driver/plugins "package.json" file. Will throw
561
- * an error if the driver/plugin does not contain a "scripts" field
562
- * underneath the "appium" field in its package.json, if the
563
- * "scripts" field is not a plain object, or if the scriptName is
564
- * not found within "scripts" object.
579
+ * Just wraps {@linkcode child_process.spawn} with some default options
580
+ *
581
+ * @param {string} cwd - CWD
582
+ * @param {string} script - Path to script
583
+ * @param {string[]} args - Extra args for script
584
+ * @param {import('child_process').SpawnOptions} opts - Options
585
+ * @returns {import('node:child_process').ChildProcess}
586
+ */
587
+ _runUnbuffered(cwd, script, args = [], opts = {}) {
588
+ return (0, child_process_1.spawn)(process.execPath, [script, ...args], {
589
+ cwd,
590
+ stdio: 'inherit',
591
+ ...opts,
592
+ });
593
+ }
594
+ /**
595
+ * Runs a script cached inside the `scripts` field under `appium`
596
+ * inside of the extension's `package.json` file. Will throw
597
+ * an error if the driver/plugin does not contain a `scripts` field
598
+ * underneath the `appium` field in its `package.json`, if the
599
+ * `scripts` field is not a plain object, or if the `scriptName` is
600
+ * not found within `scripts` object.
565
601
  *
566
602
  * @param {RunOptions} opts
567
603
  * @return {Promise<RunOutput>}
568
604
  */
569
- async _run({ installSpec, scriptName, extraArgs = [] }) {
605
+ async _run({ installSpec, scriptName, extraArgs = [], bufferOutput = false }) {
570
606
  if (!this.config.isInstalled(installSpec)) {
571
607
  throw this._createFatalError(`The ${this.type} "${installSpec}" is not installed`);
572
608
  }
@@ -583,44 +619,72 @@ class ExtensionCommand {
583
619
  if (!(scriptName in /** @type {Record<string,string>} */ (extScripts))) {
584
620
  throw this._createFatalError(`The ${this.type} named '${installSpec}' does not support the script: '${scriptName}'`);
585
621
  }
586
- const runner = new teen_process_1.SubProcess(process.execPath, [extScripts[scriptName], ...extraArgs], {
587
- cwd: this.config.getInstallPath(installSpec),
588
- });
589
- const output = new utils_1.RingBuffer(50);
590
- runner.on('stream-line', (line) => {
591
- output.enqueue(line);
592
- this.log.log(line);
593
- });
594
- await runner.start(0);
622
+ if (bufferOutput) {
623
+ const runner = new teen_process_1.SubProcess(process.execPath, [extScripts[scriptName], ...extraArgs], {
624
+ cwd: this.config.getInstallPath(installSpec),
625
+ });
626
+ const output = new utils_1.RingBuffer(50);
627
+ runner.on('stream-line', (line) => {
628
+ output.enqueue(line);
629
+ this.log.log(line);
630
+ });
631
+ await runner.start(0);
632
+ try {
633
+ await runner.join();
634
+ this.log.ok(`${scriptName} successfully ran`.green);
635
+ return { output: output.getBuff() };
636
+ }
637
+ catch (err) {
638
+ this.log.error(`Encountered an error when running '${scriptName}': ${err.message}`.red);
639
+ return { error: err.message, output: output.getBuff() };
640
+ }
641
+ }
595
642
  try {
596
- await runner.join();
643
+ await new bluebird_1.default((resolve, reject) => {
644
+ this._runUnbuffered(this.config.getInstallPath(installSpec), extScripts[scriptName], extraArgs)
645
+ .on('error', (err) => {
646
+ // generally this is of the "I can't find the script" variety.
647
+ // this is a developer bug: the extension is pointing to a script that is not where the
648
+ // developer said it would be (in `appium.scripts` of the extension's `package.json`)
649
+ reject(err);
650
+ })
651
+ .on('close', (code) => {
652
+ if (code === 0) {
653
+ resolve();
654
+ }
655
+ else {
656
+ reject(new Error(`Script "${scriptName}" exited with code ${code}`));
657
+ }
658
+ });
659
+ });
597
660
  this.log.ok(`${scriptName} successfully ran`.green);
598
- return { output: output.getBuff() };
661
+ return {};
599
662
  }
600
663
  catch (err) {
601
664
  this.log.error(`Encountered an error when running '${scriptName}': ${err.message}`.red);
602
- return { error: err.message, output: output.getBuff() };
665
+ return { error: err.message };
603
666
  }
604
667
  }
605
668
  }
606
- exports.ExtensionCommand = ExtensionCommand;
607
- exports.default = ExtensionCommand;
669
+ exports.ExtensionCommand = ExtensionCliCommand;
670
+ exports.default = ExtensionCliCommand;
608
671
  /**
609
- * Options for the {@linkcode ExtensionCommand} constructor
672
+ * Options for the {@linkcode ExtensionCliCommand} constructor
610
673
  * @template {ExtensionType} ExtType
611
674
  * @typedef ExtensionCommandOptions
612
675
  * @property {ExtensionConfig<ExtType>} config - the `DriverConfig` or `PluginConfig` instance used for this command
613
676
  * @property {boolean} json - whether the output of this command should be JSON or text
614
677
  */
615
678
  /**
616
- * Extra stuff about extensions; used indirectly by {@linkcode ExtensionCommand.list}.
679
+ * Extra stuff about extensions; used indirectly by {@linkcode ExtensionCliCommand.list}.
617
680
  *
618
- * @typedef ExtensionMetadata
681
+ * @typedef ExtensionListMetadata
619
682
  * @property {boolean} installed - If `true`, the extension is installed
620
- * @property {string?} updateVersion - If the extension is installed, the version it can be updated to
621
- * @property {string?} unsafeUpdateVersion - Same as above, but a major version bump
622
683
  * @property {boolean} upToDate - If the extension is installed and the latest
623
- * @property {string?} updateError - Update check error message (if present)
684
+ * @property {string|null} updateVersion - If the extension is installed, the version it can be updated to
685
+ * @property {string|null} unsafeUpdateVersion - Same as above, but a major version bump
686
+ * @property {string} [updateError] - Update check error message (if present)
687
+ * @property {boolean} [devMode] - If Appium is run from an extension's working copy
624
688
  */
625
689
  /**
626
690
  * @typedef {import('@appium/types').ExtensionType} ExtensionType
@@ -652,62 +716,65 @@ exports.default = ExtensionCommand;
652
716
  * @typedef {import('appium/types').ExtInstallReceipt<ExtType>} ExtInstallReceipt
653
717
  */
654
718
  /**
655
- * Possible return value for {@linkcode ExtensionCommand.list}
656
- * @typedef {Partial<InstalledExtensionListData> & {pkgName: string, installed: false}} UninstalledExtensionListData
719
+ * Possible return value for {@linkcode ExtensionCliCommand.list}
720
+ * @template {ExtensionType} ExtType
721
+ * @typedef {Partial<ExtManifest<ExtType>> & Partial<ExtensionListMetadata>} ExtensionListData
657
722
  */
658
723
  /**
659
- * Possible return value for {@linkcode ExtensionCommand.list}
660
- * @typedef {import('appium/types').InternalMetadata & ExtensionMetadata} InstalledExtensionListData
724
+ * @template {ExtensionType} ExtType
725
+ * @typedef {ExtManifest<ExtType> & ExtensionListMetadata} InstalledExtensionListData
661
726
  */
662
727
  /**
663
- * Return value of {@linkcode ExtensionCommand.list}.
664
- * @typedef {Record<string,InstalledExtensionListData|UninstalledExtensionListData>} ExtensionListData
728
+ * Return value of {@linkcode ExtensionCliCommand.list}.
729
+ * @template {ExtensionType} ExtType
730
+ * @typedef {Record<string,ExtensionListData<ExtType>>} ExtensionList
665
731
  */
666
732
  /**
667
- * Options for {@linkcode ExtensionCommand._run}.
733
+ * Options for {@linkcode ExtensionCliCommand._run}.
668
734
  * @typedef RunOptions
669
735
  * @property {string} installSpec - name of the extension to run a script from
670
736
  * @property {string} scriptName - name of the script to run
671
737
  * @property {string[]} [extraArgs] - arguments to pass to the script
738
+ * @property {boolean} [bufferOutput] - if true, will buffer the output of the script and return it
672
739
  */
673
740
  /**
674
- * Return value of {@linkcode ExtensionCommand._run}
741
+ * Return value of {@linkcode ExtensionCliCommand._run}
675
742
  *
676
743
  * @typedef RunOutput
677
744
  * @property {string} [error] - error message if script ran unsuccessfully, otherwise undefined
678
- * @property {string[]} output - script output
745
+ * @property {string[]} [output] - script output if `bufferOutput` was `true` in {@linkcode RunOptions}
679
746
  */
680
747
  /**
681
- * Options for {@linkcode ExtensionCommand._update}.
748
+ * Options for {@linkcode ExtensionCliCommand._update}.
682
749
  * @typedef ExtensionUpdateOpts
683
750
  * @property {string} installSpec - the name of the extension to update
684
751
  * @property {boolean} unsafe - if true, will perform unsafe updates past major revision boundaries
685
752
  */
686
753
  /**
687
- * Return value of {@linkcode ExtensionCommand._update}.
754
+ * Return value of {@linkcode ExtensionCliCommand._update}.
688
755
  * @typedef ExtensionUpdateResult
689
756
  * @property {Record<string,Error>} errors - map of ext names to error objects
690
757
  * @property {Record<string,UpdateReport>} updates - map of ext names to {@linkcode UpdateReport}s
691
758
  */
692
759
  /**
693
- * Part of result of {@linkcode ExtensionCommand._update}.
760
+ * Part of result of {@linkcode ExtensionCliCommand._update}.
694
761
  * @typedef UpdateReport
695
762
  * @property {string} from - version the extension was updated from
696
763
  * @property {string} to - version the extension was updated to
697
764
  */
698
765
  /**
699
- * Options for {@linkcode ExtensionCommand._uninstall}.
766
+ * Options for {@linkcode ExtensionCliCommand._uninstall}.
700
767
  * @typedef UninstallOpts
701
768
  * @property {string} installSpec - the name or spec of an extension to uninstall
702
769
  */
703
770
  /**
704
- * Used by {@linkcode ExtensionCommand.getPostInstallText}
771
+ * Used by {@linkcode ExtensionCliCommand.getPostInstallText}
705
772
  * @typedef ExtensionArgs
706
773
  * @property {string} extName - the name of an extension
707
774
  * @property {object} extData - the data for an installed extension
708
775
  */
709
776
  /**
710
- * Options for {@linkcode ExtensionCommand.installViaNpm}
777
+ * Options for {@linkcode ExtensionCliCommand.installViaNpm}
711
778
  * @typedef InstallViaNpmArgs
712
779
  * @property {string} installSpec - the name or spec of an extension to install
713
780
  * @property {string} pkgName - the NPM package name of the extension
@@ -715,14 +782,14 @@ exports.default = ExtensionCommand;
715
782
  * @property {string} [pkgVer] - the specific version of the NPM package
716
783
  */
717
784
  /**
718
- * Object returned by {@linkcode ExtensionCommand.checkForExtensionUpdate}
785
+ * Object returned by {@linkcode ExtensionCliCommand.checkForExtensionUpdate}
719
786
  * @typedef PossibleUpdates
720
787
  * @property {string} current - current version
721
788
  * @property {string?} safeUpdate - version we can safely update to if it exists, or null
722
789
  * @property {string?} unsafeUpdate - version we can unsafely update to if it exists, or null
723
790
  */
724
791
  /**
725
- * Options for {@linkcode ExtensionCommand._install}
792
+ * Options for {@linkcode ExtensionCliCommand._install}
726
793
  * @typedef InstallOpts
727
794
  * @property {string} installSpec - the name or spec of an extension to install
728
795
  * @property {InstallType} installType - how to install this extension. One of the INSTALL_TYPES
@@ -736,9 +803,10 @@ exports.default = ExtensionCommand;
736
803
  * @typedef ListOptions
737
804
  * @property {boolean} showInstalled - whether should show only installed extensions
738
805
  * @property {boolean} showUpdates - whether should show available updates
806
+ * @property {boolean} [verbose] - whether to show additional data from the extension
739
807
  */
740
808
  /**
741
- * Opts for {@linkcode ExtensionCommand.getInstallationReceipt}
809
+ * Opts for {@linkcode ExtensionCliCommand.getInstallationReceipt}
742
810
  * @template {ExtensionType} ExtType
743
811
  * @typedef GetInstallationReceiptOpts
744
812
  * @property {string} installPath