@appium/support 7.0.4 → 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.
- package/build/lib/console.d.ts +42 -88
- package/build/lib/console.d.ts.map +1 -1
- package/build/lib/console.js +25 -85
- package/build/lib/console.js.map +1 -1
- package/build/lib/doctor.d.ts +6 -18
- package/build/lib/doctor.d.ts.map +1 -1
- package/build/lib/doctor.js +0 -15
- package/build/lib/doctor.js.map +1 -1
- package/build/lib/env.d.ts +14 -20
- package/build/lib/env.d.ts.map +1 -1
- package/build/lib/env.js +24 -61
- package/build/lib/env.js.map +1 -1
- package/build/lib/fs.d.ts +109 -148
- package/build/lib/fs.d.ts.map +1 -1
- package/build/lib/fs.js +130 -230
- package/build/lib/fs.js.map +1 -1
- package/build/lib/image-util.d.ts +7 -6
- package/build/lib/image-util.d.ts.map +1 -1
- package/build/lib/image-util.js +9 -6
- package/build/lib/image-util.js.map +1 -1
- package/build/lib/index.d.ts +19 -17
- package/build/lib/index.d.ts.map +1 -1
- package/build/lib/logger.d.ts +1 -1
- package/build/lib/logger.d.ts.map +1 -1
- package/build/lib/logger.js +1 -1
- package/build/lib/logger.js.map +1 -1
- package/build/lib/logging.d.ts +7 -15
- package/build/lib/logging.d.ts.map +1 -1
- package/build/lib/logging.js +36 -62
- package/build/lib/logging.js.map +1 -1
- package/build/lib/mjpeg.d.ts +19 -56
- package/build/lib/mjpeg.d.ts.map +1 -1
- package/build/lib/mjpeg.js +55 -78
- package/build/lib/mjpeg.js.map +1 -1
- package/build/lib/mkdirp.d.ts +4 -1
- package/build/lib/mkdirp.d.ts.map +1 -1
- package/build/lib/mkdirp.js +1 -2
- package/build/lib/mkdirp.js.map +1 -1
- package/build/lib/net.d.ts +52 -90
- package/build/lib/net.d.ts.map +1 -1
- package/build/lib/net.js +104 -193
- package/build/lib/net.js.map +1 -1
- package/build/lib/node.d.ts +16 -17
- package/build/lib/node.d.ts.map +1 -1
- package/build/lib/node.js +115 -120
- package/build/lib/node.js.map +1 -1
- package/build/lib/npm.d.ts +65 -86
- package/build/lib/npm.d.ts.map +1 -1
- package/build/lib/npm.js +64 -122
- package/build/lib/npm.js.map +1 -1
- package/build/lib/plist.d.ts +36 -29
- package/build/lib/plist.d.ts.map +1 -1
- package/build/lib/plist.js +62 -59
- package/build/lib/plist.js.map +1 -1
- package/build/lib/process.d.ts +19 -2
- package/build/lib/process.d.ts.map +1 -1
- package/build/lib/process.js +24 -7
- package/build/lib/process.js.map +1 -1
- package/build/lib/system.d.ts +41 -6
- package/build/lib/system.d.ts.map +1 -1
- package/build/lib/system.js +49 -14
- package/build/lib/system.js.map +1 -1
- package/build/lib/tempdir.d.ts +26 -49
- package/build/lib/tempdir.d.ts.map +1 -1
- package/build/lib/tempdir.js +46 -78
- package/build/lib/tempdir.js.map +1 -1
- package/build/lib/timing.d.ts +28 -22
- package/build/lib/timing.d.ts.map +1 -1
- package/build/lib/timing.js +16 -17
- package/build/lib/timing.js.map +1 -1
- package/build/lib/util.d.ts +164 -181
- package/build/lib/util.d.ts.map +1 -1
- package/build/lib/util.js +198 -253
- package/build/lib/util.js.map +1 -1
- package/build/lib/zip.d.ts +81 -139
- package/build/lib/zip.d.ts.map +1 -1
- package/build/lib/zip.js +235 -283
- package/build/lib/zip.js.map +1 -1
- package/lib/console.ts +139 -0
- package/lib/{doctor.js → doctor.ts} +6 -20
- package/lib/{env.js → env.ts} +34 -62
- package/lib/fs.ts +453 -0
- package/lib/image-util.ts +40 -0
- package/lib/index.ts +1 -0
- package/lib/{logger.js → logger.ts} +1 -1
- package/lib/logging.ts +157 -0
- package/lib/mjpeg.ts +186 -0
- package/lib/{mkdirp.js → mkdirp.ts} +2 -2
- package/lib/net.ts +305 -0
- package/lib/{node.js → node.ts} +136 -135
- package/lib/npm.ts +291 -0
- package/lib/plist.ts +187 -0
- package/lib/process.ts +62 -0
- package/lib/system.ts +95 -0
- package/lib/tempdir.ts +115 -0
- package/lib/{timing.js → timing.ts} +28 -33
- package/lib/util.ts +561 -0
- package/lib/{zip.js → zip.ts} +344 -299
- package/package.json +24 -26
- package/tsconfig.json +3 -5
- package/index.js +0 -1
- package/lib/console.js +0 -173
- package/lib/fs.js +0 -496
- package/lib/image-util.js +0 -32
- package/lib/logging.js +0 -145
- package/lib/mjpeg.js +0 -207
- package/lib/net.js +0 -336
- package/lib/npm.js +0 -310
- package/lib/plist.js +0 -182
- package/lib/process.js +0 -46
- package/lib/system.js +0 -48
- package/lib/tempdir.js +0 -131
- package/lib/util.js +0 -585
package/build/lib/mjpeg.js
CHANGED
|
@@ -8,10 +8,9 @@ const lodash_1 = __importDefault(require("lodash"));
|
|
|
8
8
|
const logger_1 = __importDefault(require("./logger"));
|
|
9
9
|
const bluebird_1 = __importDefault(require("bluebird"));
|
|
10
10
|
const image_util_1 = require("./image-util");
|
|
11
|
-
const
|
|
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
|
-
class MJpegStream extends
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
class MJpegStream extends node_stream_1.Writable {
|
|
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
|
-
*
|
|
41
|
-
* @param
|
|
42
|
-
* @param
|
|
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 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 =
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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
|
|
72
|
-
if (lodash_1.default.isEmpty(
|
|
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)()(
|
|
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 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
|
|
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 stream_1.Writable {
|
|
|
117
96
|
})).data;
|
|
118
97
|
}
|
|
119
98
|
catch (e) {
|
|
120
|
-
|
|
121
|
-
|
|
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 = (
|
|
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 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
|
-
//
|
|
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)
|
|
148
|
-
.pipe(this.consumer)
|
|
149
|
-
.pipe(this);
|
|
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 stream_1.Writable {
|
|
|
165
144
|
}
|
|
166
145
|
this.clear();
|
|
167
146
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
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();
|
package/build/lib/mjpeg.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mjpeg.js","sourceRoot":"","sources":["../../lib/mjpeg.
|
|
1
|
+
{"version":3,"file":"mjpeg.js","sourceRoot":"","sources":["../../lib/mjpeg.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AACvB,sDAA2B;AAC3B,wDAAyB;AACzB,6CAA0C;AAC1C,6CAA0E;AAC1E,iCAAsC;AACtC,kDAA0B;AAK1B,IAAI,aAAa,GAAoC,IAAI,CAAC;AAE1D;;GAEG;AACH,KAAK,UAAU,iBAAiB;IAC9B,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,IAAI,CAAC;YACH,aAAa,GAAG,CAAC,MAAM,IAAA,qBAAc,EAAC,gBAAgB,CAAC,CAA6B,CAAC;QACvF,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,IAAI,KAAK,CACb,qEAAqE;gBACnE,uEAAuE,CAC1E,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,aAAa,CAAC;AACvB,CAAC;AAED,MAAM,uBAAuB,GAAG,KAAK,CAAC;AAEtC,+DAA+D;AAC/D,MAAa,WAAY,SAAQ,sBAAQ;IAC9B,YAAY,CAAuB;IACnC,GAAG,CAAS;IACrB,wHAAwH;IAChH,WAAW,GAAG,CAAC,CAAC;IACxB,8KAA8K;IACtK,SAAS,GAAkB,IAAI,CAAC;IAChC,oBAAoB,GAAwB,IAAI,CAAC;IACjD,oBAAoB,GAAkC,IAAI,CAAC;IAC3D,cAAc,GAAoB,IAAI,CAAC;IACvC,QAAQ,GAAkC,IAAI,CAAC;IAEvD;;;;OAIG;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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"}
|
package/build/lib/mkdirp.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mkdirp.d.ts","sourceRoot":"","sources":["../../lib/mkdirp.
|
|
1
|
+
{"version":3,"file":"mkdirp.d.ts","sourceRoot":"","sources":["../../lib/mkdirp.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAO,MAAM,6DAAM,CAAC"}
|
package/build/lib/mkdirp.js
CHANGED
package/build/lib/mkdirp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mkdirp.js","sourceRoot":"","sources":["../../lib/mkdirp.
|
|
1
|
+
{"version":3,"file":"mkdirp.js","sourceRoot":"","sources":["../../lib/mkdirp.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAExB;;GAEG;AACW,cAAM,GAAI,OAAE,QAAC"}
|
package/build/lib/net.d.ts
CHANGED
|
@@ -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
|
-
*
|
|
45
|
+
* Options for {@linkcode uploadFile} when the remote uses the `ftp` protocol.
|
|
3
46
|
*/
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
*
|
|
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?:
|
|
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
|
|
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
|
package/build/lib/net.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"net.d.ts","sourceRoot":"","sources":["../../lib/net.
|
|
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,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