@appium/support 7.0.5 → 7.0.6

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 (114) hide show
  1. package/LICENSE +201 -0
  2. package/build/lib/console.d.ts +42 -88
  3. package/build/lib/console.d.ts.map +1 -1
  4. package/build/lib/console.js +20 -80
  5. package/build/lib/console.js.map +1 -1
  6. package/build/lib/doctor.d.ts +6 -18
  7. package/build/lib/doctor.d.ts.map +1 -1
  8. package/build/lib/doctor.js +0 -15
  9. package/build/lib/doctor.js.map +1 -1
  10. package/build/lib/env.d.ts +14 -20
  11. package/build/lib/env.d.ts.map +1 -1
  12. package/build/lib/env.js +13 -50
  13. package/build/lib/env.js.map +1 -1
  14. package/build/lib/fs.d.ts +109 -148
  15. package/build/lib/fs.d.ts.map +1 -1
  16. package/build/lib/fs.js +88 -188
  17. package/build/lib/fs.js.map +1 -1
  18. package/build/lib/image-util.d.ts +7 -6
  19. package/build/lib/image-util.d.ts.map +1 -1
  20. package/build/lib/image-util.js +9 -6
  21. package/build/lib/image-util.js.map +1 -1
  22. package/build/lib/index.d.ts +19 -17
  23. package/build/lib/index.d.ts.map +1 -1
  24. package/build/lib/logger.d.ts +1 -1
  25. package/build/lib/logger.d.ts.map +1 -1
  26. package/build/lib/logger.js +1 -1
  27. package/build/lib/logger.js.map +1 -1
  28. package/build/lib/logging.d.ts +7 -15
  29. package/build/lib/logging.d.ts.map +1 -1
  30. package/build/lib/logging.js +36 -62
  31. package/build/lib/logging.js.map +1 -1
  32. package/build/lib/mjpeg.d.ts +19 -56
  33. package/build/lib/mjpeg.d.ts.map +1 -1
  34. package/build/lib/mjpeg.js +53 -76
  35. package/build/lib/mjpeg.js.map +1 -1
  36. package/build/lib/mkdirp.d.ts +4 -1
  37. package/build/lib/mkdirp.d.ts.map +1 -1
  38. package/build/lib/mkdirp.js +1 -2
  39. package/build/lib/mkdirp.js.map +1 -1
  40. package/build/lib/net.d.ts +52 -90
  41. package/build/lib/net.d.ts.map +1 -1
  42. package/build/lib/net.js +104 -193
  43. package/build/lib/net.js.map +1 -1
  44. package/build/lib/node.d.ts +16 -17
  45. package/build/lib/node.d.ts.map +1 -1
  46. package/build/lib/node.js +106 -111
  47. package/build/lib/node.js.map +1 -1
  48. package/build/lib/npm.d.ts +65 -86
  49. package/build/lib/npm.d.ts.map +1 -1
  50. package/build/lib/npm.js +59 -117
  51. package/build/lib/npm.js.map +1 -1
  52. package/build/lib/plist.d.ts +36 -29
  53. package/build/lib/plist.d.ts.map +1 -1
  54. package/build/lib/plist.js +62 -59
  55. package/build/lib/plist.js.map +1 -1
  56. package/build/lib/process.d.ts +19 -2
  57. package/build/lib/process.d.ts.map +1 -1
  58. package/build/lib/process.js +24 -7
  59. package/build/lib/process.js.map +1 -1
  60. package/build/lib/system.d.ts +41 -6
  61. package/build/lib/system.d.ts.map +1 -1
  62. package/build/lib/system.js +46 -11
  63. package/build/lib/system.js.map +1 -1
  64. package/build/lib/tempdir.d.ts +26 -49
  65. package/build/lib/tempdir.d.ts.map +1 -1
  66. package/build/lib/tempdir.js +41 -73
  67. package/build/lib/tempdir.js.map +1 -1
  68. package/build/lib/timing.d.ts +28 -22
  69. package/build/lib/timing.d.ts.map +1 -1
  70. package/build/lib/timing.js +16 -17
  71. package/build/lib/timing.js.map +1 -1
  72. package/build/lib/util.d.ts +164 -181
  73. package/build/lib/util.d.ts.map +1 -1
  74. package/build/lib/util.js +193 -247
  75. package/build/lib/util.js.map +1 -1
  76. package/build/lib/zip.d.ts +81 -139
  77. package/build/lib/zip.d.ts.map +1 -1
  78. package/build/lib/zip.js +210 -258
  79. package/build/lib/zip.js.map +1 -1
  80. package/lib/console.ts +139 -0
  81. package/lib/{doctor.js → doctor.ts} +6 -20
  82. package/lib/{env.js → env.ts} +31 -59
  83. package/lib/fs.ts +453 -0
  84. package/lib/image-util.ts +40 -0
  85. package/lib/index.ts +1 -0
  86. package/lib/{logger.js → logger.ts} +1 -1
  87. package/lib/logging.ts +157 -0
  88. package/lib/mjpeg.ts +186 -0
  89. package/lib/{mkdirp.js → mkdirp.ts} +2 -2
  90. package/lib/net.ts +305 -0
  91. package/lib/{node.js → node.ts} +134 -133
  92. package/lib/npm.ts +291 -0
  93. package/lib/plist.ts +187 -0
  94. package/lib/process.ts +62 -0
  95. package/lib/system.ts +95 -0
  96. package/lib/tempdir.ts +115 -0
  97. package/lib/{timing.js → timing.ts} +28 -33
  98. package/lib/util.ts +561 -0
  99. package/lib/{zip.js → zip.ts} +341 -296
  100. package/package.json +20 -22
  101. package/tsconfig.json +3 -5
  102. package/index.js +0 -1
  103. package/lib/console.js +0 -173
  104. package/lib/fs.js +0 -496
  105. package/lib/image-util.js +0 -32
  106. package/lib/logging.js +0 -145
  107. package/lib/mjpeg.js +0 -207
  108. package/lib/net.js +0 -336
  109. package/lib/npm.js +0 -310
  110. package/lib/plist.js +0 -182
  111. package/lib/process.js +0 -46
  112. package/lib/system.js +0 -48
  113. package/lib/tempdir.js +0 -131
  114. package/lib/util.js +0 -584
@@ -11,7 +11,6 @@ const image_util_1 = require("./image-util");
11
11
  const node_stream_1 = require("node:stream");
12
12
  const node_1 = require("./node");
13
13
  const axios_1 = __importDefault(require("axios"));
14
- // lazy load this, as it might not be available
15
14
  let MJpegConsumer = null;
16
15
  /**
17
16
  * @throws {Error} If `mjpeg-consumer` module is not installed or cannot be loaded
@@ -19,29 +18,32 @@ let MJpegConsumer = null;
19
18
  async function initMJpegConsumer() {
20
19
  if (!MJpegConsumer) {
21
20
  try {
22
- MJpegConsumer = await (0, node_1.requirePackage)('mjpeg-consumer');
21
+ MJpegConsumer = (await (0, node_1.requirePackage)('mjpeg-consumer'));
22
+ }
23
+ catch {
24
+ throw new Error('mjpeg-consumer module is required to use MJPEG-over-HTTP features. ' +
25
+ 'Please install it first (npm i -g mjpeg-consumer) and restart Appium.');
23
26
  }
24
- catch { }
25
- }
26
- if (!MJpegConsumer) {
27
- throw new Error('mjpeg-consumer module is required to use MJPEG-over-HTTP features. ' +
28
- 'Please install it first (npm i -g mjpeg-consumer) and restart Appium.');
29
27
  }
28
+ return MJpegConsumer;
30
29
  }
31
- // amount of time to wait for the first image in the stream
32
30
  const MJPEG_SERVER_TIMEOUT_MS = 10000;
33
31
  /** Class which stores the last bit of data streamed into it */
34
32
  class MJpegStream extends node_stream_1.Writable {
35
- /**
36
- * @type {number}
37
- */
33
+ errorHandler;
34
+ url;
35
+ /** Number of JPEG frames received so far (reset on {@linkcode clear}). Use stream['updateCount'] in tests if needed. */
38
36
  updateCount = 0;
37
+ /** Last received JPEG chunk (base64 via {@linkcode lastChunkBase64}); `null` when no data yet or after {@linkcode clear}/stop. Use stream['lastChunk'] in tests if needed. */
38
+ lastChunk = null;
39
+ registerStartSuccess = null;
40
+ registerStartFailure = null;
41
+ responseStream = null;
42
+ consumer = null;
39
43
  /**
40
- * Create an MJpegStream
41
- * @param {string} mJpegUrl - URL of MJPEG-over-HTTP stream
42
- * @param {function} [errorHandler=noop] - additional function that will be
43
- * called in the case of any errors.
44
- * @param {object} [options={}] - Options to pass to the Writable constructor
44
+ * @param mJpegUrl - URL of MJPEG-over-HTTP stream
45
+ * @param errorHandler - additional function that will be called in the case of any errors
46
+ * @param options - Options to pass to the Writable constructor
45
47
  */
46
48
  constructor(mJpegUrl, errorHandler = lodash_1.default.noop, options = {}) {
47
49
  super(options);
@@ -49,49 +51,30 @@ class MJpegStream extends node_stream_1.Writable {
49
51
  this.url = mJpegUrl;
50
52
  this.clear();
51
53
  }
52
- /**
53
- * Get the base64-encoded version of the JPEG
54
- *
55
- * @returns {?string} base64-encoded JPEG image data
56
- * or `null` if no image can be parsed
57
- */
58
54
  get lastChunkBase64() {
59
- const lastChunk = /** @type {Buffer} */ (this.lastChunk);
60
- return !lodash_1.default.isEmpty(this.lastChunk) && lodash_1.default.isBuffer(this.lastChunk)
61
- ? lastChunk.toString('base64')
62
- : null;
55
+ const lastChunk = this.lastChunk;
56
+ if (lastChunk && !lodash_1.default.isEmpty(lastChunk) && lodash_1.default.isBuffer(lastChunk)) {
57
+ return lastChunk.toString('base64');
58
+ }
59
+ return null;
63
60
  }
64
- /**
65
- * Get the PNG version of the JPEG buffer
66
- *
67
- * @returns {Promise<Buffer?>} PNG image data or `null` if no PNG
68
- * image can be parsed
69
- */
70
61
  async lastChunkPNG() {
71
- const lastChunk = /** @type {Buffer} */ (this.lastChunk);
72
- if (lodash_1.default.isEmpty(lastChunk) || !lodash_1.default.isBuffer(lastChunk)) {
62
+ const chunk = this.lastChunk;
63
+ if (!chunk || lodash_1.default.isEmpty(chunk) || !lodash_1.default.isBuffer(chunk)) {
73
64
  return null;
74
65
  }
75
66
  try {
76
- return await (0, image_util_1.requireSharp)()(lastChunk).png().toBuffer();
67
+ return await (0, image_util_1.requireSharp)()(chunk).png().toBuffer();
77
68
  }
78
- catch {
69
+ catch (err) {
70
+ logger_1.default.warn(`Cannot convert MJPEG chunk to PNG: ${err.message}`);
79
71
  return null;
80
72
  }
81
73
  }
82
- /**
83
- * Get the base64-encoded version of the PNG
84
- *
85
- * @returns {Promise<string?>} base64-encoded PNG image data
86
- * or `null` if no image can be parsed
87
- */
88
74
  async lastChunkPNGBase64() {
89
75
  const png = await this.lastChunkPNG();
90
76
  return png ? png.toString('base64') : null;
91
77
  }
92
- /**
93
- * Reset internal state
94
- */
95
78
  clear() {
96
79
  this.registerStartSuccess = null;
97
80
  this.registerStartFailure = null;
@@ -100,14 +83,10 @@ class MJpegStream extends node_stream_1.Writable {
100
83
  this.lastChunk = null;
101
84
  this.updateCount = 0;
102
85
  }
103
- /**
104
- * Start reading the MJpeg stream and storing the last image
105
- */
106
86
  async start(serverTimeout = MJPEG_SERVER_TIMEOUT_MS) {
107
- // ensure we're not started already
108
87
  this.stop();
109
- await initMJpegConsumer();
110
- this.consumer = new MJpegConsumer();
88
+ const Consumer = await initMJpegConsumer();
89
+ this.consumer = new Consumer();
111
90
  const url = this.url;
112
91
  try {
113
92
  this.responseStream = (await (0, axios_1.default)({
@@ -117,11 +96,19 @@ class MJpegStream extends node_stream_1.Writable {
117
96
  })).data;
118
97
  }
119
98
  catch (e) {
120
- throw new Error(`Cannot connect to the MJPEG stream at ${url}. ` +
121
- `Original error: ${lodash_1.default.has(e, 'response') ? JSON.stringify(e.response) : /** @type {Error} */ (e).message}`);
99
+ let message;
100
+ if (e && typeof e === 'object' && 'response' in e) {
101
+ message = JSON.stringify(e.response);
102
+ }
103
+ else if (e instanceof Error) {
104
+ message = e.message;
105
+ }
106
+ else {
107
+ message = String(e);
108
+ }
109
+ throw new Error(`Cannot connect to the MJPEG stream at ${url}. Original error: ${message}`);
122
110
  }
123
- const onErr = (/** @type {Error} */ err) => {
124
- // Make sure we don't get an outdated screenshot if there was an error
111
+ const onErr = (err) => {
125
112
  this.lastChunk = null;
126
113
  logger_1.default.error(`Error getting MJpeg screenshot chunk: ${err.message}`);
127
114
  this.errorHandler(err);
@@ -133,26 +120,18 @@ class MJpegStream extends node_stream_1.Writable {
133
120
  logger_1.default.debug(`The connection to MJPEG server at ${url} has been closed`);
134
121
  this.lastChunk = null;
135
122
  };
136
- // use the deferred pattern so we can wait for the start of the stream
137
- // based on what comes in from an external pipe
123
+ // TODO: replace with native Promises in Appium 4
138
124
  const startPromise = new bluebird_1.default((res, rej) => {
139
125
  this.registerStartSuccess = res;
140
126
  this.registerStartFailure = rej;
141
- })
142
- // start a timeout so that if the server does not return data, we don't
143
- // block forever.
144
- .timeout(serverTimeout, `Waited ${serverTimeout}ms but the MJPEG server never sent any images`);
127
+ }).timeout(serverTimeout, `Waited ${serverTimeout}ms but the MJPEG server never sent any images`);
145
128
  this.responseStream
146
129
  .once('close', onClose)
147
- .on('error', onErr) // ensure we do something with errors
148
- .pipe(this.consumer) // allow chunking and transforming of jpeg data
149
- .pipe(this); // send the actual jpegs to ourself
130
+ .on('error', onErr)
131
+ .pipe(this.consumer)
132
+ .pipe(this);
150
133
  await startPromise;
151
134
  }
152
- /**
153
- * Stop reading the MJpeg stream. Ensure we disconnect all the pipes and stop
154
- * the HTTP request itself. Then reset the state.
155
- */
156
135
  stop() {
157
136
  if (this.consumer) {
158
137
  this.consumer.unpipe(this);
@@ -165,14 +144,12 @@ class MJpegStream extends node_stream_1.Writable {
165
144
  }
166
145
  this.clear();
167
146
  }
168
- /**
169
- * Override the Writable write() method in order to save the last image and
170
- * log the number of images we have received
171
- * @override
172
- * @param {Buffer} data - binary data streamed from the MJpeg consumer
173
- */
174
- write(data) {
175
- this.lastChunk = data;
147
+ /* eslint-disable @typescript-eslint/no-unused-vars -- Writable.write signature requires encoding and callback */
148
+ /* eslint-disable promise/prefer-await-to-callbacks -- Node Writable.write is callback-based */
149
+ write(data, encoding, callback) {
150
+ /* eslint-enable @typescript-eslint/no-unused-vars */
151
+ /* eslint-enable promise/prefer-await-to-callbacks */
152
+ this.lastChunk = Buffer.isBuffer(data) ? data : Buffer.from(data);
176
153
  this.updateCount++;
177
154
  if (this.registerStartSuccess) {
178
155
  this.registerStartSuccess();
@@ -1 +1 @@
1
- {"version":3,"file":"mjpeg.js","sourceRoot":"","sources":["../../lib/mjpeg.js"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AACvB,sDAA2B;AAC3B,wDAAyB;AACzB,6CAA0C;AAC1C,6CAAqC;AACrC,iCAAsC;AACtC,kDAA0B;AAE1B,+CAA+C;AAC/C,IAAI,aAAa,GAAG,IAAI,CAAC;AAEzB;;GAEG;AACH,KAAK,UAAU,iBAAiB;IAC9B,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,IAAI,CAAC;YACH,aAAa,GAAG,MAAM,IAAA,qBAAc,EAAC,gBAAgB,CAAC,CAAC;QACzD,CAAC;QAAC,MAAM,CAAC,CAAA,CAAC;IACZ,CAAC;IACD,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CACb,qEAAqE;YACnE,uEAAuE,CAC1E,CAAC;IACJ,CAAC;AACH,CAAC;AAED,2DAA2D;AAC3D,MAAM,uBAAuB,GAAG,KAAK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,EAAE,CAAC;YAClB,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC7B,CAAC;QACD,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YACxB,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;gBAClB,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAC5C,CAAC;YACD,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;QAChC,CAAC;QACD,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;IAED,iHAAiH;IACjH,+FAA+F;IACtF,KAAK,CACZ,IAAkC,EAClC,QAA2D,EAC3D,QAAwC;QAExC,qDAAqD;QACrD,qDAAqD;QACrD,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClE,IAAI,CAAC,WAAW,EAAE,CAAC;QACnB,IAAI,IAAI,CAAC,oBAAoB,EAAE,CAAC;YAC9B,IAAI,CAAC,oBAAoB,EAAE,CAAC;YAC5B,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC;QACnC,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAxJD,kCAwJC"}
@@ -1,2 +1,5 @@
1
- export const mkdirp: (dir: PathLike) => Promise<string | undefined>;
1
+ /**
2
+ * @deprecated Use `fs.mkdirp` instead.
3
+ */
4
+ export declare const mkdirp: (dir: import("fs").PathLike) => Promise<string | undefined>;
2
5
  //# sourceMappingURL=mkdirp.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mkdirp.d.ts","sourceRoot":"","sources":["../../lib/mkdirp.js"],"names":[],"mappings":""}
1
+ {"version":3,"file":"mkdirp.d.ts","sourceRoot":"","sources":["../../lib/mkdirp.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAO,MAAM,6DAAM,CAAC"}
@@ -5,6 +5,5 @@ const fs_1 = require("./fs");
5
5
  /**
6
6
  * @deprecated Use `fs.mkdirp` instead.
7
7
  */
8
- const { mkdirp } = fs_1.fs;
9
- exports.mkdirp = mkdirp;
8
+ exports.mkdirp = fs_1.fs.mkdirp;
10
9
  //# sourceMappingURL=mkdirp.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mkdirp.js","sourceRoot":"","sources":["../../lib/mkdirp.js"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB;;GAEG;AACH,MAAM,EAAC,MAAM,EAAC,GAAG,OAAE,CAAC;AACZ,wBAAM"}
1
+ {"version":3,"file":"mkdirp.js","sourceRoot":"","sources":["../../lib/mkdirp.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAExB;;GAEG;AACW,cAAM,GAAI,OAAE,QAAC"}
@@ -1,99 +1,61 @@
1
+ import { type Method } from 'axios';
2
+ import type { HTTPHeaders } from '@appium/types';
3
+ /** Common options for {@linkcode uploadFile} and {@linkcode downloadFile}. */
4
+ export interface NetOptions {
5
+ /** Whether to log the actual download performance (e.g. timings and speed). Defaults to true. */
6
+ isMetered?: boolean;
7
+ /** Authentication credentials */
8
+ auth?: AuthCredentials;
9
+ }
10
+ /** Basic auth credentials; used by {@linkcode NetOptions}. */
11
+ export interface AuthCredentials {
12
+ /** Non-empty user name (or use `username` for axios-style) */
13
+ user?: string;
14
+ /** Non-empty password (or use `password` for axios-style) */
15
+ pass?: string;
16
+ username?: string;
17
+ password?: string;
18
+ }
19
+ /** Specific options for {@linkcode downloadFile}. */
20
+ export interface DownloadOptions extends NetOptions {
21
+ /** Request timeout in milliseconds; defaults to {@linkcode DEFAULT_TIMEOUT_MS} */
22
+ timeout?: number;
23
+ /** Request headers mapping */
24
+ headers?: Record<string, unknown>;
25
+ }
26
+ /** Options for {@linkcode uploadFile} when the remote uses the `http(s)` protocol. */
27
+ export interface HttpUploadOptions extends NetOptions {
28
+ /** Additional request headers */
29
+ headers?: HTTPHeaders;
30
+ /** HTTP method for file upload. Defaults to 'POST'. */
31
+ method?: Method;
32
+ /** Request timeout in milliseconds; defaults to {@linkcode DEFAULT_TIMEOUT_MS} */
33
+ timeout?: number;
34
+ /**
35
+ * Name of the form field containing the file. Any falsy value uses non-multipart upload.
36
+ * Defaults to 'file'.
37
+ */
38
+ fileFieldName?: string;
39
+ /**
40
+ * Additional form fields. Only considered if `fileFieldName` is set.
41
+ */
42
+ formFields?: Record<string, unknown> | [string, unknown][];
43
+ }
1
44
  /**
2
- * Common options for {@linkcode uploadFile} and {@linkcode downloadFile}.
45
+ * Options for {@linkcode uploadFile} when the remote uses the `ftp` protocol.
3
46
  */
4
- export type NetOptions = {
5
- /**
6
- * - Whether to log the actual download performance
7
- * (e.g. timings and speed)
8
- */
9
- isMetered?: boolean | undefined;
10
- /**
11
- * - Authentication credentials
12
- */
13
- auth?: AuthCredentials | undefined;
14
- };
15
- /**
16
- * Specific options for {@linkcode downloadFile}.
17
- */
18
- export type DownloadOptions = {
19
- /**
20
- * - The actual request timeout in milliseconds; defaults to {@linkcode DEFAULT_TIMEOUT_MS}
21
- */
22
- timeout?: number | undefined;
23
- /**
24
- * - Request headers mapping
25
- */
26
- headers?: Record<string, any> | undefined;
27
- };
28
- /**
29
- * Basic auth credentials; used by {@linkcode NetOptions}.
30
- */
31
- export type AuthCredentials = {
32
- /**
33
- * - Non-empty user name
34
- */
35
- user: string;
36
- /**
37
- * - Non-empty password
38
- */
39
- pass: string;
40
- };
47
+ export interface FtpUploadOptions extends NetOptions {
48
+ }
49
+ /** @deprecated Use {@linkcode FtpUploadOptions} instead. */
50
+ export type NotHttpUploadOptions = FtpUploadOptions;
41
51
  /**
42
- * This type is used in {@linkcode uploadFile} if the remote location uses the `ftp` protocol, and distinguishes the type from {@linkcode HttpUploadOptions}.
43
- */
44
- export type NotHttpUploadOptions = {
45
- headers: never;
46
- method: never;
47
- timeout: never;
48
- fileFieldName: never;
49
- formFields: never;
50
- };
51
- /**
52
- * Specific options for {@linkcode uploadFile} if the remote location uses the `http(s)` protocol
53
- */
54
- export type HttpUploadOptions = {
55
- /**
56
- * - Additional request headers mapping
57
- */
58
- headers?: import("@appium/types").HTTPHeaders | undefined;
59
- /**
60
- * - The HTTP method used for file upload
61
- */
62
- method?: axios.Method | undefined;
63
- /**
64
- * - The actual request timeout in milliseconds; defaults to {@linkcode DEFAULT_TIMEOUT_MS}
65
- */
66
- timeout?: number | undefined;
67
- /**
68
- * - The name of the form field containing the file
69
- * content to be uploaded. Any falsy value make the request to use non-multipart upload
70
- */
71
- fileFieldName?: string | undefined;
72
- /**
73
- * - The additional form fields
74
- * to be included into the upload request. This property is only considered if
75
- * `fileFieldName` is set
76
- */
77
- formFields?: Record<string, any> | [string, any][] | undefined;
78
- };
79
- /**
80
- * Uploads the given file to a remote location. HTTP(S) and FTP
81
- * protocols are supported.
82
- *
83
- * @param {string} localPath - The path to a file on the local storage.
84
- * @param {string} remoteUri - The remote URI to upload the file to.
85
- * @param {(HttpUploadOptions|NotHttpUploadOptions) & NetOptions} [uploadOptions]
86
- * @returns {Promise<void>}
52
+ * Uploads the given file to a remote location. HTTP(S) and FTP protocols are supported.
87
53
  */
88
- export function uploadFile(localPath: string, remoteUri: string, uploadOptions?: (HttpUploadOptions | NotHttpUploadOptions) & NetOptions): Promise<void>;
54
+ export declare function uploadFile(localPath: string, remoteUri: string, uploadOptions?: HttpUploadOptions | FtpUploadOptions): Promise<void>;
89
55
  /**
90
- * Downloads the given file via HTTP(S)
56
+ * Downloads the given file via HTTP(S).
91
57
  *
92
- * @param {string} remoteUrl - The remote url
93
- * @param {string} dstPath - The local path to download the file to
94
- * @param {DownloadOptions & NetOptions} [downloadOptions]
95
58
  * @throws {Error} If download operation fails
96
59
  */
97
- export function downloadFile(remoteUrl: string, dstPath: string, downloadOptions?: DownloadOptions & NetOptions): Promise<void>;
98
- import axios from 'axios';
60
+ export declare function downloadFile(remoteUrl: string, dstPath: string, downloadOptions?: DownloadOptions): Promise<void>;
99
61
  //# sourceMappingURL=net.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"net.d.ts","sourceRoot":"","sources":["../../lib/net.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAsTc,MAAM;;;;UACN,MAAM;;;;;;aAMN,KAAK;YACL,KAAK;aACL,KAAK;mBACL,KAAK;gBACL,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAzJnB;;;;;;;;GAQG;AACH,sCALW,MAAM,aACN,MAAM,kBACN,CAAC,iBAAiB,GAAC,oBAAoB,CAAC,GAAG,UAAU,GACnD,OAAO,CAAC,IAAI,CAAC,CAyCzB;AAED;;;;;;;GAOG;AACH,wCALW,MAAM,WACN,MAAM,oBACN,eAAe,GAAG,UAAU,iBAiEtC;kBAzRiB,OAAO"}
1
+ {"version":3,"file":"net.d.ts","sourceRoot":"","sources":["../../lib/net.ts"],"names":[],"mappings":"AAMA,OAAc,EAA6B,KAAK,MAAM,EAA6B,MAAM,OAAO,CAAC;AAEjG,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAI/C,8EAA8E;AAC9E,MAAM,WAAW,UAAU;IACzB,iGAAiG;IACjG,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,iCAAiC;IACjC,IAAI,CAAC,EAAE,eAAe,CAAC;CACxB;AAED,8DAA8D;AAC9D,MAAM,WAAW,eAAe;IAC9B,8DAA8D;IAC9D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6DAA6D;IAC7D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,qDAAqD;AACrD,MAAM,WAAW,eAAgB,SAAQ,UAAU;IACjD,kFAAkF;IAClF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8BAA8B;IAC9B,OAAO,CAAC,EAAE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