@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.
- package/LICENSE +201 -0
- package/build/lib/console.d.ts +42 -88
- package/build/lib/console.d.ts.map +1 -1
- package/build/lib/console.js +20 -80
- 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 +13 -50
- 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 +88 -188
- 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 +53 -76
- 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 +106 -111
- 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 +59 -117
- 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 +46 -11
- 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 +41 -73
- 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 +193 -247
- 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 +210 -258
- 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} +31 -59
- 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} +134 -133
- 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} +341 -296
- package/package.json +20 -22
- 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 -584
package/build/lib/index.d.ts
CHANGED
|
@@ -23,36 +23,38 @@ declare const _default: {
|
|
|
23
23
|
system: typeof system;
|
|
24
24
|
util: typeof util;
|
|
25
25
|
fs: {
|
|
26
|
-
hasAccess(
|
|
27
|
-
isExecutable(
|
|
28
|
-
exists(
|
|
29
|
-
rimraf(filepath: PathLike): Promise<void>;
|
|
30
|
-
rimrafSync(filepath: PathLike): void;
|
|
26
|
+
hasAccess(filePath: import("fs").PathLike): Promise<boolean>;
|
|
27
|
+
isExecutable(filePath: import("fs").PathLike): Promise<boolean>;
|
|
28
|
+
exists(filePath: import("fs").PathLike): Promise<boolean>;
|
|
29
|
+
rimraf(filepath: import("fs").PathLike): Promise<void>;
|
|
30
|
+
rimrafSync(filepath: import("fs").PathLike): void;
|
|
31
31
|
mkdir(filepath: string | Buffer | URL, opts?: import("fs").MakeDirectoryOptions): Promise<string | undefined>;
|
|
32
32
|
copyFile(source: string, destination: string, opts?: import("ncp").Options): Promise<void>;
|
|
33
|
-
md5(filePath: PathLike): Promise<string>;
|
|
34
|
-
mv(from: string, to: string, opts?:
|
|
33
|
+
md5(filePath: import("fs").PathLike): Promise<string>;
|
|
34
|
+
mv(from: string, to: string, opts?: import("./fs").MvOptions): Promise<void>;
|
|
35
35
|
which: typeof import("which");
|
|
36
|
-
glob
|
|
36
|
+
glob(pattern: string, options?: import("glob/raw").GlobOptions): Promise<string[]>;
|
|
37
37
|
sanitizeName: typeof import("sanitize-filename");
|
|
38
|
-
hash(filePath: PathLike, algorithm?: string): Promise<string>;
|
|
38
|
+
hash(filePath: import("fs").PathLike, algorithm?: string): Promise<string>;
|
|
39
39
|
walk(dir: string, opts?: import("klaw").Options): import("klaw").Walker;
|
|
40
|
-
mkdirp(dir: PathLike): Promise<string | undefined>;
|
|
41
|
-
walkDir(dir: string, recursive: boolean, callback: WalkDirCallback): Promise<string | null>;
|
|
42
|
-
readPackageJsonFrom(dir: string, opts?: import("read-pkg"
|
|
40
|
+
mkdirp(dir: import("fs").PathLike): Promise<string | undefined>;
|
|
41
|
+
walkDir(dir: string, recursive: boolean, callback: import("./fs").WalkDirCallback): Promise<string | null>;
|
|
42
|
+
readPackageJsonFrom(dir: string, opts?: import("read-pkg", { with: { "resolution-mode": "import" } }).NormalizeOptions & {
|
|
43
|
+
cwd?: string;
|
|
44
|
+
}): import("read-pkg", { with: { "resolution-mode": "import" } }).NormalizedPackageJson;
|
|
43
45
|
findRoot(dir: string): string;
|
|
44
46
|
access: typeof import("fs/promises").access;
|
|
45
47
|
appendFile: typeof import("fs/promises").appendFile;
|
|
46
48
|
chmod: typeof import("fs/promises").chmod;
|
|
47
|
-
close:
|
|
49
|
+
close: typeof import("fs").close.__promisify__;
|
|
48
50
|
constants: typeof import("fs").constants;
|
|
49
51
|
createWriteStream: typeof import("fs").createWriteStream;
|
|
50
52
|
createReadStream: typeof import("fs").createReadStream;
|
|
51
53
|
lstat: typeof import("fs/promises").lstat;
|
|
52
|
-
open:
|
|
54
|
+
open: typeof import("fs").open.__promisify__;
|
|
53
55
|
openFile: typeof import("fs/promises").open;
|
|
54
56
|
readdir: typeof import("fs/promises").readdir;
|
|
55
|
-
read: import("
|
|
57
|
+
read: typeof import("fs").read.__promisify__;
|
|
56
58
|
readFile: typeof import("fs/promises").readFile;
|
|
57
59
|
readlink: typeof import("fs/promises").readlink;
|
|
58
60
|
realpath: typeof import("fs/promises").realpath;
|
|
@@ -69,7 +71,7 @@ declare const _default: {
|
|
|
69
71
|
};
|
|
70
72
|
cancellableDelay: typeof util.cancellableDelay;
|
|
71
73
|
plist: typeof plist;
|
|
72
|
-
mkdirp: (dir: PathLike) => Promise<string | undefined>;
|
|
74
|
+
mkdirp: (dir: import("fs").PathLike) => Promise<string | undefined>;
|
|
73
75
|
logger: typeof logger;
|
|
74
76
|
process: typeof process;
|
|
75
77
|
zip: typeof zip;
|
|
@@ -85,7 +87,7 @@ declare const _default: {
|
|
|
85
87
|
export default _default;
|
|
86
88
|
export type { ConsoleOpts } from './console';
|
|
87
89
|
export type { ReadFn, WalkDirCallback } from './fs';
|
|
88
|
-
export type { NetOptions, DownloadOptions, AuthCredentials, NotHttpUploadOptions, HttpUploadOptions, } from './net';
|
|
90
|
+
export type { NetOptions, DownloadOptions, AuthCredentials, FtpUploadOptions, NotHttpUploadOptions, HttpUploadOptions, } from './net';
|
|
89
91
|
export type { InstallPackageOpts, ExecOpts, NpmInstallReceipt } from './npm';
|
|
90
92
|
export type { Affixes, OpenedAffixes } from './tempdir';
|
|
91
93
|
export type { PluralizeOptions, EncodingOptions, LockFileOptions, NonEmptyString } from './util';
|
package/build/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAC,EAAE,EAAC,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAC7B,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,MAAM,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC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ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../lib/logger.
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../lib/logger.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,GAAG,8CAAuB,CAAC;AAEjC,eAAe,GAAG,CAAC"}
|
package/build/lib/logger.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const logging_1 = require("./logging");
|
|
4
|
-
|
|
4
|
+
const log = (0, logging_1.getLogger)('Support');
|
|
5
5
|
exports.default = log;
|
|
6
6
|
//# sourceMappingURL=logger.js.map
|
package/build/lib/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../lib/logger.
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../lib/logger.ts"],"names":[],"mappings":";;AAAA,uCAAoC;AAEpC,MAAM,GAAG,GAAG,IAAA,mBAAS,EAAC,SAAS,CAAC,CAAC;AAEjC,kBAAe,GAAG,CAAC"}
|
package/build/lib/logging.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import type { AppiumLogger, AppiumLoggerLevel, AppiumLoggerPrefix } from '@appium/types';
|
|
2
|
+
export declare const LEVELS: readonly AppiumLoggerLevel[];
|
|
3
|
+
export declare const log: AppiumLogger;
|
|
1
4
|
/**
|
|
2
|
-
*
|
|
3
|
-
* @
|
|
4
|
-
* @returns {AppiumLogger}
|
|
5
|
+
* @param prefix - Optional log prefix
|
|
6
|
+
* @returns A wrapped Appium logger instance
|
|
5
7
|
*/
|
|
6
|
-
export function getLogger(prefix?: AppiumLoggerPrefix | null): AppiumLogger;
|
|
8
|
+
export declare function getLogger(prefix?: AppiumLoggerPrefix | null): AppiumLogger;
|
|
7
9
|
/**
|
|
8
10
|
* Marks arbitrary log message as sensitive.
|
|
9
11
|
* This message will then be replaced with the default replacer
|
|
@@ -12,19 +14,9 @@ export function getLogger(prefix?: AppiumLoggerPrefix | null): AppiumLogger;
|
|
|
12
14
|
* The latter is enabled by the corresponding HTTP middleware
|
|
13
15
|
* in response to the `X-Appium-Is-Sensitive` request header
|
|
14
16
|
* being set to 'true'.
|
|
15
|
-
*
|
|
16
|
-
* @template {any} T
|
|
17
|
-
* @param {T} logMessage
|
|
18
|
-
* @returns {{[k: string]: T}}
|
|
19
17
|
*/
|
|
20
|
-
export function markSensitive<T
|
|
18
|
+
export declare function markSensitive<T>(logMessage: T): {
|
|
21
19
|
[k: string]: T;
|
|
22
20
|
};
|
|
23
|
-
/** @type {import('@appium/types').AppiumLoggerLevel[]} */
|
|
24
|
-
export const LEVELS: import("@appium/types").AppiumLoggerLevel[];
|
|
25
|
-
export const log: import("@appium/types").AppiumLogger;
|
|
26
21
|
export default log;
|
|
27
|
-
export type AppiumLoggerPrefix = import("@appium/types").AppiumLoggerPrefix;
|
|
28
|
-
export type AppiumLogger = import("@appium/types").AppiumLogger;
|
|
29
|
-
export type AppiumLoggerLevel = import("@appium/types").AppiumLoggerLevel;
|
|
30
22
|
//# sourceMappingURL=logging.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["../../lib/logging.
|
|
1
|
+
{"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["../../lib/logging.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,YAAY,EAEZ,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,eAAe,CAAC;AAGvB,eAAO,MAAM,MAAM,EAAE,SAAS,iBAAiB,EAQ9C,CAAC;AAyBF,eAAO,MAAM,GAAG,cAAc,CAAC;AAE/B;;;GAGG;AACH,wBAAgB,SAAS,CAAC,MAAM,GAAE,kBAAkB,GAAG,IAAW,GAAG,YAAY,CA8DhF;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,GAAG;IAAC,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,CAAA;CAAC,CAEhE;AA8BD,eAAe,GAAG,CAAC"}
|
package/build/lib/logging.js
CHANGED
|
@@ -41,53 +41,49 @@ exports.getLogger = getLogger;
|
|
|
41
41
|
exports.markSensitive = markSensitive;
|
|
42
42
|
const logger_1 = __importStar(require("@appium/logger"));
|
|
43
43
|
const lodash_1 = __importDefault(require("lodash"));
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
exports.LEVELS = [
|
|
45
|
+
'silly',
|
|
46
|
+
'verbose',
|
|
47
|
+
'debug',
|
|
48
|
+
'info',
|
|
49
|
+
'http',
|
|
50
|
+
'warn',
|
|
51
|
+
'error',
|
|
52
|
+
];
|
|
47
53
|
const MAX_LOG_RECORDS_COUNT = 3000;
|
|
48
|
-
const
|
|
54
|
+
const globalWithNpmlog = globalThis;
|
|
49
55
|
// mock log object is used in testing mode to silence the output
|
|
50
56
|
const MOCK_LOG = {
|
|
51
57
|
unwrap: () => ({
|
|
52
|
-
loadSecureValuesPreprocessingRules: () => ({
|
|
53
|
-
issues: [],
|
|
54
|
-
rules: [],
|
|
55
|
-
}),
|
|
58
|
+
loadSecureValuesPreprocessingRules: () => Promise.resolve({ issues: [], rules: [] }),
|
|
56
59
|
level: 'verbose',
|
|
57
60
|
prefix: '',
|
|
58
61
|
log: lodash_1.default.noop,
|
|
59
62
|
}),
|
|
60
|
-
...
|
|
63
|
+
...lodash_1.default.fromPairs(exports.LEVELS.map((l) => [l, lodash_1.default.noop])),
|
|
61
64
|
};
|
|
62
|
-
// export a default logger with no prefix
|
|
63
65
|
exports.log = getLogger();
|
|
64
66
|
/**
|
|
65
|
-
*
|
|
66
|
-
* @
|
|
67
|
-
* @returns {AppiumLogger}
|
|
67
|
+
* @param prefix - Optional log prefix
|
|
68
|
+
* @returns A wrapped Appium logger instance
|
|
68
69
|
*/
|
|
69
70
|
function getLogger(prefix = null) {
|
|
70
|
-
const
|
|
71
|
-
// wrap the logger so that we can catch and modify any logging
|
|
71
|
+
const { logger, defaultToVerbose } = _getLogger();
|
|
72
72
|
const wrappedLogger = {
|
|
73
73
|
unwrap: () => logger,
|
|
74
|
-
levels: exports.LEVELS,
|
|
75
|
-
prefix,
|
|
76
|
-
errorWithException(
|
|
74
|
+
levels: [...exports.LEVELS],
|
|
75
|
+
prefix: prefix ?? undefined,
|
|
76
|
+
errorWithException(...args) {
|
|
77
77
|
this.error(...args);
|
|
78
|
-
// make sure we have an `Error` object. Wrap if necessary
|
|
79
78
|
return lodash_1.default.isError(args[0]) ? args[0] : new Error(args.join('\n'));
|
|
80
79
|
},
|
|
81
|
-
errorAndThrow(
|
|
82
|
-
throw this.errorWithException(args);
|
|
80
|
+
errorAndThrow(...args) {
|
|
81
|
+
throw this.errorWithException(...args);
|
|
83
82
|
},
|
|
84
|
-
updateAsyncContext(
|
|
85
|
-
/** @type {import('@appium/types').AppiumLoggerContext} */ contextInfo, replace = false) {
|
|
86
|
-
// Older Appium dependencies may not have 'updateAsyncStorage'
|
|
83
|
+
updateAsyncContext(contextInfo, replace = false) {
|
|
87
84
|
this.unwrap().updateAsyncStorage?.(contextInfo, replace);
|
|
88
85
|
},
|
|
89
86
|
};
|
|
90
|
-
// allow access to the level of the underlying logger
|
|
91
87
|
Object.defineProperty(wrappedLogger, 'level', {
|
|
92
88
|
get() {
|
|
93
89
|
return logger.level;
|
|
@@ -99,12 +95,10 @@ function getLogger(prefix = null) {
|
|
|
99
95
|
configurable: true,
|
|
100
96
|
});
|
|
101
97
|
const isDebugTimestampLoggingEnabled = process.env._LOG_TIMESTAMP === '1';
|
|
102
|
-
// add all the levels from `npmlog`, and map to the underlying logger
|
|
103
98
|
for (const level of exports.LEVELS) {
|
|
104
|
-
wrappedLogger[level] =
|
|
99
|
+
wrappedLogger[level] = function (...args) {
|
|
105
100
|
const finalPrefix = getFinalPrefix(this.prefix, isDebugTimestampLoggingEnabled);
|
|
106
101
|
if (args.length) {
|
|
107
|
-
// @ts-ignore This is OK
|
|
108
102
|
logger[level](finalPrefix, ...args);
|
|
109
103
|
}
|
|
110
104
|
else {
|
|
@@ -112,13 +106,12 @@ function getLogger(prefix = null) {
|
|
|
112
106
|
}
|
|
113
107
|
};
|
|
114
108
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
// package set the log level
|
|
109
|
+
// Default to verbose when the global was not already set (first use, or standalone);
|
|
110
|
+
// main server will override later.
|
|
111
|
+
if (defaultToVerbose) {
|
|
119
112
|
wrappedLogger.level = 'verbose';
|
|
120
113
|
}
|
|
121
|
-
return
|
|
114
|
+
return wrappedLogger;
|
|
122
115
|
}
|
|
123
116
|
/**
|
|
124
117
|
* Marks arbitrary log message as sensitive.
|
|
@@ -128,51 +121,32 @@ function getLogger(prefix = null) {
|
|
|
128
121
|
* The latter is enabled by the corresponding HTTP middleware
|
|
129
122
|
* in response to the `X-Appium-Is-Sensitive` request header
|
|
130
123
|
* being set to 'true'.
|
|
131
|
-
*
|
|
132
|
-
* @template {any} T
|
|
133
|
-
* @param {T} logMessage
|
|
134
|
-
* @returns {{[k: string]: T}}
|
|
135
124
|
*/
|
|
136
125
|
function markSensitive(logMessage) {
|
|
137
126
|
return (0, logger_1.markSensitive)(logMessage);
|
|
138
127
|
}
|
|
139
|
-
/**
|
|
140
|
-
*
|
|
141
|
-
* @returns {[import('@appium/logger').Logger, boolean]}
|
|
142
|
-
*/
|
|
143
128
|
function _getLogger() {
|
|
144
|
-
// check if the user set the `_TESTING` or `_FORCE_LOGS` flag
|
|
145
129
|
const testingMode = process.env._TESTING === '1';
|
|
146
130
|
const forceLogMode = process.env._FORCE_LOGS === '1';
|
|
147
|
-
|
|
148
|
-
// in which case we want t o use that
|
|
149
|
-
const useGlobalLog = !!global._global_npmlog;
|
|
131
|
+
const defaultToVerbose = !globalWithNpmlog._global_npmlog;
|
|
150
132
|
const logger = testingMode && !forceLogMode
|
|
151
|
-
// in testing mode, use a mock logger object that we can query
|
|
152
133
|
? MOCK_LOG
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
134
|
+
: (globalWithNpmlog._global_npmlog ?? logger_1.default);
|
|
135
|
+
if (!testingMode && !globalWithNpmlog._global_npmlog && logger === logger_1.default) {
|
|
136
|
+
globalWithNpmlog._global_npmlog = logger_1.default;
|
|
137
|
+
logger.maxRecordSize = MAX_LOG_RECORDS_COUNT;
|
|
138
|
+
}
|
|
139
|
+
return { logger, defaultToVerbose };
|
|
158
140
|
}
|
|
159
|
-
/**
|
|
160
|
-
* @param {AppiumLoggerPrefix?} prefix
|
|
161
|
-
* @param {boolean} [shouldLogTimestamp=false] whether to include timestamps into log prefixes
|
|
162
|
-
* @returns {string}
|
|
163
|
-
*/
|
|
164
141
|
function getFinalPrefix(prefix, shouldLogTimestamp = false) {
|
|
165
142
|
const result = (lodash_1.default.isFunction(prefix) ? prefix() : prefix) ?? '';
|
|
166
143
|
if (!shouldLogTimestamp) {
|
|
167
144
|
return result;
|
|
168
145
|
}
|
|
169
|
-
const
|
|
146
|
+
const now = new Date();
|
|
147
|
+
const pad = (n, z = 2) => String(n).padStart(z, '0');
|
|
148
|
+
const formattedTimestamp = `[${pad(now.getHours())}-${pad(now.getMinutes())}-${pad(now.getSeconds())}:${pad(now.getMilliseconds(), 3)}]`;
|
|
170
149
|
return result ? `${formattedTimestamp} ${result}` : formattedTimestamp;
|
|
171
150
|
}
|
|
172
151
|
exports.default = exports.log;
|
|
173
|
-
/**
|
|
174
|
-
* @typedef {import('@appium/types').AppiumLoggerPrefix} AppiumLoggerPrefix
|
|
175
|
-
* @typedef {import('@appium/types').AppiumLogger} AppiumLogger
|
|
176
|
-
* @typedef {import('@appium/types').AppiumLoggerLevel} AppiumLoggerLevel
|
|
177
|
-
*/
|
|
178
152
|
//# sourceMappingURL=logging.js.map
|
package/build/lib/logging.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logging.js","sourceRoot":"","sources":["../../lib/logging.
|
|
1
|
+
{"version":3,"file":"logging.js","sourceRoot":"","sources":["../../lib/logging.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,8BA8DC;AAWD,sCAEC;AA9HD,yDAGwB;AAOxB,oDAAuB;AAEV,QAAA,MAAM,GAAiC;IAClD,OAAO;IACP,SAAS;IACT,OAAO;IACP,MAAM;IACN,MAAM;IACN,MAAM;IACN,OAAO;CACR,CAAC;AAEF,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAMnC,MAAM,gBAAgB,GAAG,UAAkD,CAAC;AAE5E,gEAAgE;AAChE,MAAM,QAAQ,GAAG;IACf,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;QACb,kCAAkC,EAAE,GAAG,EAAE,CACvC,OAAO,CAAC,OAAO,CAAC,EAAC,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAC,CAAC;QAC1C,KAAK,EAAE,SAAS;QAChB,MAAM,EAAE,EAAE;QACV,GAAG,EAAE,gBAAC,CAAC,IAAI;KACZ,CAAC;IACF,GAAI,gBAAC,CAAC,SAAS,CAAC,cAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,gBAAC,CAAC,IAAI,CAAC,CAAC,CAG5C;CACkB,CAAC;AAEV,QAAA,GAAG,GAAG,SAAS,EAAE,CAAC;AAE/B;;;GAGG;AACH,SAAgB,SAAS,CAAC,SAAoC,IAAI;IAChE,MAAM,EAAC,MAAM,EAAE,gBAAgB,EAAC,GAAG,UAAU,EAAE,CAAC;IAEhD,MAAM,aAAa,GAAG;QACpB,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM;QACpB,MAAM,EAAE,CAAC,GAAG,cAAM,CAAC;QACnB,MAAM,EAAE,MAAM,IAAI,SAAS;QAC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AM,CAAC;IAChB,CAAC;IACD,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;IACvB,MAAM,GAAG,GAAG,CAAC,CAAS,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC7D,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC;IACzI,OAAO,MAAM,CAAC,CAAC,CAAC,GAAG,kBAAkB,IAAI,MAAM,EAAE,CAAC,CAAC,CAAC,kBAAkB,CAAC;AACzE,CAAC;AAED,kBAAe,WAAG,CAAC"}
|
package/build/lib/mjpeg.d.ts
CHANGED
|
@@ -1,65 +1,28 @@
|
|
|
1
|
+
import { Writable, type WritableOptions } from 'node:stream';
|
|
1
2
|
/** Class which stores the last bit of data streamed into it */
|
|
2
|
-
export class MJpegStream extends Writable {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
*
|
|
20
|
-
* @returns {?string} base64-encoded JPEG image data
|
|
21
|
-
* or `null` if no image can be parsed
|
|
22
|
-
*/
|
|
3
|
+
export declare class MJpegStream extends Writable {
|
|
4
|
+
readonly errorHandler: (err: Error) => void;
|
|
5
|
+
readonly url: string;
|
|
6
|
+
/** Number of JPEG frames received so far (reset on {@linkcode clear}). Use stream['updateCount'] in tests if needed. */
|
|
7
|
+
private updateCount;
|
|
8
|
+
/** 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. */
|
|
9
|
+
private lastChunk;
|
|
10
|
+
private registerStartSuccess;
|
|
11
|
+
private registerStartFailure;
|
|
12
|
+
private responseStream;
|
|
13
|
+
private consumer;
|
|
14
|
+
/**
|
|
15
|
+
* @param mJpegUrl - URL of MJPEG-over-HTTP stream
|
|
16
|
+
* @param errorHandler - additional function that will be called in the case of any errors
|
|
17
|
+
* @param options - Options to pass to the Writable constructor
|
|
18
|
+
*/
|
|
19
|
+
constructor(mJpegUrl: string, errorHandler?: (err: Error) => void, options?: WritableOptions);
|
|
23
20
|
get lastChunkBase64(): string | null;
|
|
24
|
-
/**
|
|
25
|
-
* Get the PNG version of the JPEG buffer
|
|
26
|
-
*
|
|
27
|
-
* @returns {Promise<Buffer?>} PNG image data or `null` if no PNG
|
|
28
|
-
* image can be parsed
|
|
29
|
-
*/
|
|
30
21
|
lastChunkPNG(): Promise<Buffer | null>;
|
|
31
|
-
/**
|
|
32
|
-
* Get the base64-encoded version of the PNG
|
|
33
|
-
*
|
|
34
|
-
* @returns {Promise<string?>} base64-encoded PNG image data
|
|
35
|
-
* or `null` if no image can be parsed
|
|
36
|
-
*/
|
|
37
22
|
lastChunkPNGBase64(): Promise<string | null>;
|
|
38
|
-
/**
|
|
39
|
-
* Reset internal state
|
|
40
|
-
*/
|
|
41
23
|
clear(): void;
|
|
42
|
-
registerStartSuccess: ((thenableOrResult?: any) => void) | null | undefined;
|
|
43
|
-
registerStartFailure: ((error?: any) => void) | null | undefined;
|
|
44
|
-
responseStream: any;
|
|
45
|
-
consumer: any;
|
|
46
|
-
lastChunk: Buffer<ArrayBufferLike> | null | undefined;
|
|
47
|
-
/**
|
|
48
|
-
* Start reading the MJpeg stream and storing the last image
|
|
49
|
-
*/
|
|
50
24
|
start(serverTimeout?: number): Promise<void>;
|
|
51
|
-
/**
|
|
52
|
-
* Stop reading the MJpeg stream. Ensure we disconnect all the pipes and stop
|
|
53
|
-
* the HTTP request itself. Then reset the state.
|
|
54
|
-
*/
|
|
55
25
|
stop(): void;
|
|
56
|
-
|
|
57
|
-
* Override the Writable write() method in order to save the last image and
|
|
58
|
-
* log the number of images we have received
|
|
59
|
-
* @override
|
|
60
|
-
* @param {Buffer} data - binary data streamed from the MJpeg consumer
|
|
61
|
-
*/
|
|
62
|
-
override write(data: Buffer): boolean;
|
|
26
|
+
write(data: Buffer | string | Uint8Array, encoding?: BufferEncoding | ((error: Error | null) => void), callback?: (error: Error | null) => void): boolean;
|
|
63
27
|
}
|
|
64
|
-
import { Writable } from 'node:stream';
|
|
65
28
|
//# sourceMappingURL=mjpeg.d.ts.map
|
package/build/lib/mjpeg.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mjpeg.d.ts","sourceRoot":"","sources":["../../lib/mjpeg.
|
|
1
|
+
{"version":3,"file":"mjpeg.d.ts","sourceRoot":"","sources":["../../lib/mjpeg.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,QAAQ,EAAE,KAAK,eAAe,EAAgB,MAAM,aAAa,CAAC;AA4B1E,+DAA+D;AAC/D,qBAAa,WAAY,SAAQ,QAAQ;IACvC,QAAQ,CAAC,YAAY,EAAE,CAAC,GAAG,EAAE,KAAK,KAAK,IAAI,CAAC;IAC5C,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,wHAAwH;IACxH,OAAO,CAAC,WAAW,CAAK;IACxB,8KAA8K;IAC9K,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,oBAAoB,CAA6B;IACzD,OAAO,CAAC,oBAAoB,CAAuC;IACnE,OAAO,CAAC,cAAc,CAAyB;IAC/C,OAAO,CAAC,QAAQ,CAAuC;IAEvD;;;;OAIG;gBAED,QAAQ,EAAE,MAAM,EAChB,YAAY,GAAE,CAAC,GAAG,EAAE,KAAK,KAAK,IAAa,EAC3C,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