appium 3.2.2 → 3.3.1
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/appium.d.ts +147 -205
- package/build/lib/appium.d.ts.map +1 -1
- package/build/lib/appium.js +169 -282
- package/build/lib/appium.js.map +1 -1
- package/build/lib/bidi-commands.d.ts.map +1 -1
- package/build/lib/bidi-commands.js +11 -11
- package/build/lib/bidi-commands.js.map +1 -1
- package/build/lib/bootstrap/appium-initializer.d.ts +21 -0
- package/build/lib/bootstrap/appium-initializer.d.ts.map +1 -0
- package/build/lib/bootstrap/appium-initializer.js +146 -0
- package/build/lib/bootstrap/appium-initializer.js.map +1 -0
- package/build/lib/bootstrap/appium-main-runner.d.ts +22 -0
- package/build/lib/bootstrap/appium-main-runner.d.ts.map +1 -0
- package/build/lib/bootstrap/appium-main-runner.js +109 -0
- package/build/lib/bootstrap/appium-main-runner.js.map +1 -0
- package/build/lib/bootstrap/config-file.d.ts +37 -0
- package/build/lib/bootstrap/config-file.d.ts.map +1 -0
- package/build/lib/{config-file.js → bootstrap/config-file.js} +62 -138
- package/build/lib/bootstrap/config-file.js.map +1 -0
- package/build/lib/bootstrap/grid-v3-register.d.ts +20 -0
- package/build/lib/bootstrap/grid-v3-register.d.ts.map +1 -0
- package/build/lib/bootstrap/grid-v3-register.js +185 -0
- package/build/lib/bootstrap/grid-v3-register.js.map +1 -0
- package/build/lib/bootstrap/init-types.d.ts +16 -0
- package/build/lib/bootstrap/init-types.d.ts.map +1 -0
- package/build/lib/bootstrap/init-types.js +3 -0
- package/build/lib/bootstrap/init-types.js.map +1 -0
- package/build/lib/bootstrap/main-helpers.d.ts +55 -0
- package/build/lib/bootstrap/main-helpers.d.ts.map +1 -0
- package/build/lib/bootstrap/main-helpers.js +187 -0
- package/build/lib/bootstrap/main-helpers.js.map +1 -0
- package/build/lib/bootstrap/node-helpers.d.ts +32 -0
- package/build/lib/bootstrap/node-helpers.d.ts.map +1 -0
- package/build/lib/bootstrap/node-helpers.js +201 -0
- package/build/lib/bootstrap/node-helpers.js.map +1 -0
- package/build/lib/bootstrap/startup-config.d.ts +22 -0
- package/build/lib/bootstrap/startup-config.d.ts.map +1 -0
- package/build/lib/bootstrap/startup-config.js +111 -0
- package/build/lib/bootstrap/startup-config.js.map +1 -0
- package/build/lib/cli/args.d.ts +16 -12
- package/build/lib/cli/args.d.ts.map +1 -1
- package/build/lib/cli/args.js +20 -40
- package/build/lib/cli/args.js.map +1 -1
- package/build/lib/cli/driver-command.d.ts +51 -93
- package/build/lib/cli/driver-command.d.ts.map +1 -1
- package/build/lib/cli/driver-command.js +11 -66
- package/build/lib/cli/driver-command.js.map +1 -1
- package/build/lib/cli/extension-command.d.ts +173 -377
- package/build/lib/cli/extension-command.d.ts.map +1 -1
- package/build/lib/cli/extension-command.js +387 -656
- package/build/lib/cli/extension-command.js.map +1 -1
- package/build/lib/cli/extension.d.ts +10 -15
- package/build/lib/cli/extension.d.ts.map +1 -1
- package/build/lib/cli/extension.js +15 -33
- package/build/lib/cli/extension.js.map +1 -1
- package/build/lib/cli/parser.d.ts +37 -66
- package/build/lib/cli/parser.d.ts.map +1 -1
- package/build/lib/cli/parser.js +69 -104
- package/build/lib/cli/parser.js.map +1 -1
- package/build/lib/cli/plugin-command.d.ts +50 -90
- package/build/lib/cli/plugin-command.d.ts.map +1 -1
- package/build/lib/cli/plugin-command.js +11 -63
- package/build/lib/cli/plugin-command.js.map +1 -1
- package/build/lib/cli/setup-command.d.ts +21 -26
- package/build/lib/cli/setup-command.d.ts.map +1 -1
- package/build/lib/cli/setup-command.js +19 -61
- package/build/lib/cli/setup-command.js.map +1 -1
- package/build/lib/cli/utils.d.ts +33 -35
- package/build/lib/cli/utils.d.ts.map +1 -1
- package/build/lib/cli/utils.js +48 -50
- package/build/lib/cli/utils.js.map +1 -1
- package/build/lib/constants.d.ts +23 -23
- package/build/lib/constants.d.ts.map +1 -1
- package/build/lib/constants.js +10 -15
- package/build/lib/constants.js.map +1 -1
- package/build/lib/doctor/doctor.d.ts +40 -57
- package/build/lib/doctor/doctor.d.ts.map +1 -1
- package/build/lib/doctor/doctor.js +31 -62
- package/build/lib/doctor/doctor.js.map +1 -1
- package/build/lib/extension/driver-config.d.ts +18 -77
- package/build/lib/extension/driver-config.d.ts.map +1 -1
- package/build/lib/extension/driver-config.js +37 -125
- package/build/lib/extension/driver-config.js.map +1 -1
- package/build/lib/extension/extension-config.d.ts +103 -210
- package/build/lib/extension/extension-config.d.ts.map +1 -1
- package/build/lib/extension/extension-config.js +180 -342
- package/build/lib/extension/extension-config.js.map +1 -1
- package/build/lib/extension/index.d.ts +12 -29
- package/build/lib/extension/index.d.ts.map +1 -1
- package/build/lib/extension/index.js +33 -75
- package/build/lib/extension/index.js.map +1 -1
- package/build/lib/extension/manifest-migrations.d.ts +3 -20
- package/build/lib/extension/manifest-migrations.d.ts.map +1 -1
- package/build/lib/extension/manifest-migrations.js +20 -101
- package/build/lib/extension/manifest-migrations.js.map +1 -1
- package/build/lib/extension/manifest.d.ts +61 -107
- package/build/lib/extension/manifest.d.ts.map +1 -1
- package/build/lib/extension/manifest.js +181 -356
- package/build/lib/extension/manifest.js.map +1 -1
- package/build/lib/extension/package-changed.d.ts +1 -3
- package/build/lib/extension/package-changed.d.ts.map +1 -1
- package/build/lib/extension/package-changed.js +8 -15
- package/build/lib/extension/package-changed.js.map +1 -1
- package/build/lib/extension/plugin-config.d.ts +10 -52
- package/build/lib/extension/plugin-config.d.ts.map +1 -1
- package/build/lib/extension/plugin-config.js +11 -63
- package/build/lib/extension/plugin-config.js.map +1 -1
- package/build/lib/helpers/build.d.ts +22 -0
- package/build/lib/helpers/build.d.ts.map +1 -0
- package/build/lib/helpers/build.js +109 -0
- package/build/lib/helpers/build.js.map +1 -0
- package/build/lib/helpers/capability.d.ts +38 -0
- package/build/lib/helpers/capability.d.ts.map +1 -0
- package/build/lib/helpers/capability.js +128 -0
- package/build/lib/helpers/capability.js.map +1 -0
- package/build/lib/helpers/network.d.ts +14 -0
- package/build/lib/helpers/network.d.ts.map +1 -0
- package/build/lib/helpers/network.js +35 -0
- package/build/lib/helpers/network.js.map +1 -0
- package/build/lib/insecure-features.js +6 -6
- package/build/lib/insecure-features.js.map +1 -1
- package/build/lib/inspector-commands.d.ts +6 -0
- package/build/lib/inspector-commands.d.ts.map +1 -1
- package/build/lib/inspector-commands.js +6 -0
- package/build/lib/inspector-commands.js.map +1 -1
- package/build/lib/logger.d.ts +2 -3
- package/build/lib/logger.d.ts.map +1 -1
- package/build/lib/logger.js +2 -3
- package/build/lib/logger.js.map +1 -1
- package/build/lib/logsink.d.ts +13 -22
- package/build/lib/logsink.d.ts.map +1 -1
- package/build/lib/logsink.js +48 -103
- package/build/lib/logsink.js.map +1 -1
- package/build/lib/main.d.ts +15 -58
- package/build/lib/main.d.ts.map +1 -1
- package/build/lib/main.js +25 -425
- package/build/lib/main.js.map +1 -1
- package/build/lib/schema/arg-spec.d.ts +32 -107
- package/build/lib/schema/arg-spec.d.ts.map +1 -1
- package/build/lib/schema/arg-spec.js +11 -107
- package/build/lib/schema/arg-spec.js.map +1 -1
- package/build/lib/schema/cli-args-guards.d.ts +34 -0
- package/build/lib/schema/cli-args-guards.d.ts.map +1 -0
- package/build/lib/schema/cli-args-guards.js +49 -0
- package/build/lib/schema/cli-args-guards.js.map +1 -0
- package/build/lib/schema/cli-args.d.ts +3 -15
- package/build/lib/schema/cli-args.d.ts.map +1 -1
- package/build/lib/schema/cli-args.js +17 -107
- package/build/lib/schema/cli-args.js.map +1 -1
- package/build/lib/schema/cli-transformers.d.ts +15 -12
- package/build/lib/schema/cli-transformers.d.ts.map +1 -1
- package/build/lib/schema/cli-transformers.js +15 -45
- package/build/lib/schema/cli-transformers.js.map +1 -1
- package/build/lib/schema/format-errors.d.ts +28 -0
- package/build/lib/schema/format-errors.d.ts.map +1 -0
- package/build/lib/schema/format-errors.js +29 -0
- package/build/lib/schema/format-errors.js.map +1 -0
- package/build/lib/schema/index.d.ts +4 -2
- package/build/lib/schema/index.d.ts.map +1 -1
- package/build/lib/schema/index.js +2 -0
- package/build/lib/schema/index.js.map +1 -1
- package/build/lib/schema/keywords.d.ts +12 -20
- package/build/lib/schema/keywords.d.ts.map +1 -1
- package/build/lib/schema/keywords.js +6 -51
- package/build/lib/schema/keywords.js.map +1 -1
- package/build/lib/schema/schema.d.ts +106 -231
- package/build/lib/schema/schema.d.ts.map +1 -1
- package/build/lib/schema/schema.js +88 -358
- package/build/lib/schema/schema.js.map +1 -1
- package/build/lib/utils.d.ts +7 -267
- package/build/lib/utils.d.ts.map +1 -1
- package/build/lib/utils.js +10 -409
- package/build/lib/utils.js.map +1 -1
- package/lib/{appium.js → appium.ts} +297 -341
- package/lib/bidi-commands.ts +10 -14
- package/lib/bootstrap/appium-initializer.ts +212 -0
- package/lib/bootstrap/appium-main-runner.ts +172 -0
- package/lib/bootstrap/config-file.ts +178 -0
- package/lib/bootstrap/grid-v3-register.ts +250 -0
- package/lib/bootstrap/init-types.ts +31 -0
- package/lib/bootstrap/main-helpers.ts +223 -0
- package/lib/bootstrap/node-helpers.ts +180 -0
- package/lib/bootstrap/startup-config.ts +143 -0
- package/lib/cli/{args.js → args.ts} +45 -56
- package/lib/cli/driver-command.ts +122 -0
- package/lib/cli/{extension-command.js → extension-command.ts} +827 -906
- package/lib/cli/extension.ts +65 -0
- package/lib/cli/{parser.js → parser.ts} +93 -116
- package/lib/cli/plugin-command.ts +117 -0
- package/lib/cli/{setup-command.js → setup-command.ts} +59 -74
- package/lib/cli/utils.ts +97 -0
- package/lib/{constants.js → constants.ts} +30 -41
- package/lib/doctor/{doctor.js → doctor.ts} +82 -92
- package/lib/extension/driver-config.ts +165 -0
- package/lib/extension/{extension-config.js → extension-config.ts} +291 -405
- package/lib/extension/index.ts +143 -0
- package/lib/extension/manifest-migrations.ts +57 -0
- package/lib/extension/manifest.ts +369 -0
- package/lib/extension/{package-changed.js → package-changed.ts} +9 -18
- package/lib/extension/plugin-config.ts +62 -0
- package/lib/helpers/build.ts +111 -0
- package/lib/helpers/capability.ts +171 -0
- package/lib/helpers/network.ts +30 -0
- package/lib/insecure-features.ts +1 -1
- package/lib/inspector-commands.ts +6 -1
- package/lib/{logger.js → logger.ts} +1 -2
- package/lib/{logsink.js → logsink.ts} +91 -137
- package/lib/main.ts +60 -0
- package/lib/schema/arg-spec.ts +131 -0
- package/lib/schema/cli-args-guards.ts +67 -0
- package/lib/schema/cli-args.ts +171 -0
- package/lib/schema/cli-transformers.ts +83 -0
- package/lib/schema/format-errors.ts +43 -0
- package/lib/schema/index.ts +4 -0
- package/lib/schema/keywords.ts +96 -0
- package/lib/schema/schema.ts +448 -0
- package/lib/utils.ts +73 -0
- package/package.json +17 -18
- package/scripts/autoinstall-extensions.js +3 -0
- package/build/lib/config-file.d.ts +0 -100
- package/build/lib/config-file.d.ts.map +0 -1
- package/build/lib/config-file.js.map +0 -1
- package/build/lib/config.d.ts +0 -70
- package/build/lib/config.d.ts.map +0 -1
- package/build/lib/config.js +0 -390
- package/build/lib/config.js.map +0 -1
- package/build/lib/grid-register.d.ts +0 -10
- package/build/lib/grid-register.d.ts.map +0 -1
- package/build/lib/grid-register.js +0 -134
- package/build/lib/grid-register.js.map +0 -1
- package/lib/cli/driver-command.js +0 -174
- package/lib/cli/extension.js +0 -74
- package/lib/cli/plugin-command.js +0 -164
- package/lib/cli/utils.js +0 -91
- package/lib/config-file.js +0 -228
- package/lib/config.js +0 -389
- package/lib/extension/driver-config.js +0 -245
- package/lib/extension/index.js +0 -169
- package/lib/extension/manifest-migrations.js +0 -136
- package/lib/extension/manifest.js +0 -550
- package/lib/extension/plugin-config.js +0 -112
- package/lib/grid-register.js +0 -146
- package/lib/main.js +0 -545
- package/lib/schema/arg-spec.js +0 -229
- package/lib/schema/cli-args.js +0 -254
- package/lib/schema/cli-transformers.js +0 -113
- package/lib/schema/index.js +0 -2
- package/lib/schema/keywords.js +0 -136
- package/lib/schema/schema.js +0 -725
- package/lib/utils.js +0 -512
package/build/lib/logsink.js
CHANGED
|
@@ -37,37 +37,36 @@ const COLOR_CODE_PATTERN = /\u001b\[(\d+(;\d+)*)?m/g; // eslint-disable-line no-
|
|
|
37
37
|
// https://www.ditig.com/publications/256-colors-cheat-sheet
|
|
38
38
|
const MIN_COLOR = 17;
|
|
39
39
|
const MAX_COLOR = 231;
|
|
40
|
-
/** @type {LRUCache<string, number>} */
|
|
41
40
|
const COLORS_CACHE = new lru_cache_1.LRUCache({
|
|
42
41
|
max: 1024,
|
|
43
42
|
ttl: 1000 * 60 * 60 * 24, // expire after 24 hours
|
|
44
43
|
updateAgeOnGet: true,
|
|
45
44
|
});
|
|
46
45
|
// npmlog is used only for emitting, we use winston for output (global is set by support)
|
|
47
|
-
/** @type {import('winston').Logger?} */
|
|
48
46
|
let log = null;
|
|
49
47
|
/**
|
|
48
|
+
* Initialize the log sink from parsed CLI/server args.
|
|
49
|
+
* Sets up Winston transports (console, optional file, optional webhook) and forwards
|
|
50
|
+
* npmlog messages to them. Call this before other logging setup.
|
|
50
51
|
*
|
|
51
|
-
* @param
|
|
52
|
-
* @returns {Promise<void>}
|
|
52
|
+
* @param args - Parsed server/CLI arguments (e.g. `loglevel`, `logFile`, `webhook`).
|
|
53
53
|
*/
|
|
54
54
|
async function init(args) {
|
|
55
55
|
logger_1.default.level = 'silent';
|
|
56
56
|
// clean up in case we have initiated before since npmlog is a global object
|
|
57
57
|
clear();
|
|
58
|
-
const
|
|
59
|
-
const transportNames = new Set(
|
|
58
|
+
const transportList = await createTransports(args);
|
|
59
|
+
const transportNames = new Set(transportList.map((tr) => tr.constructor.name));
|
|
60
60
|
log = (0, winston_1.createLogger)({
|
|
61
|
-
transports,
|
|
61
|
+
transports: transportList,
|
|
62
62
|
levels: LEVELS_MAP,
|
|
63
63
|
handleExceptions: true,
|
|
64
|
-
exitOnError: false
|
|
64
|
+
exitOnError: false,
|
|
65
65
|
});
|
|
66
66
|
const reportedLoggerErrors = new Set();
|
|
67
67
|
// Capture logs emitted via npmlog and pass them through winston
|
|
68
|
-
logger_1.default.on('log', (
|
|
68
|
+
logger_1.default.on('log', ({ level, message, prefix }) => {
|
|
69
69
|
const { sessionSignature } = logger_1.default.asyncStorage.getStore() ?? {};
|
|
70
|
-
/** @type {string[]} */
|
|
71
70
|
const prefixes = [];
|
|
72
71
|
if (sessionSignature) {
|
|
73
72
|
prefixes.push(sessionSignature);
|
|
@@ -79,23 +78,25 @@ async function init(args) {
|
|
|
79
78
|
if (!lodash_1.default.isEmpty(prefixes)) {
|
|
80
79
|
const finalPrefix = prefixes
|
|
81
80
|
.map(toDecoratedPrefix)
|
|
82
|
-
.map((pfx) => isLogColorEnabled(args) ? colorizePrefix(pfx) : pfx)
|
|
81
|
+
.map((pfx) => (isLogColorEnabled(args) ? colorizePrefix(pfx) : pfx))
|
|
83
82
|
.join('');
|
|
84
83
|
msg = `${finalPrefix} ${msg}`;
|
|
85
84
|
}
|
|
86
85
|
const winstonLevel = TO_WINSTON_LEVELS_MAP[level] || 'info';
|
|
87
86
|
try {
|
|
88
|
-
|
|
87
|
+
log[winstonLevel](msg);
|
|
89
88
|
if (lodash_1.default.isFunction(args.logHandler)) {
|
|
90
89
|
args.logHandler(level, msg);
|
|
91
90
|
}
|
|
92
91
|
}
|
|
93
92
|
catch (e) {
|
|
94
|
-
|
|
93
|
+
const err = e;
|
|
94
|
+
if (!reportedLoggerErrors.has(err.message) && process.stderr.writable) {
|
|
95
95
|
// eslint-disable-next-line no-console
|
|
96
96
|
console.error(`The log message '${lodash_1.default.truncate(msg, { length: 30 })}' cannot be written into ` +
|
|
97
|
-
`one or more requested destinations: ${transportNames}.
|
|
98
|
-
|
|
97
|
+
`one or more requested destinations: ${[...transportNames].join(', ')}. ` +
|
|
98
|
+
`Original error: ${err.message}`);
|
|
99
|
+
reportedLoggerErrors.add(err.message);
|
|
99
100
|
}
|
|
100
101
|
}
|
|
101
102
|
});
|
|
@@ -103,50 +104,24 @@ async function init(args) {
|
|
|
103
104
|
logger_1.default.stream = null;
|
|
104
105
|
}
|
|
105
106
|
/**
|
|
106
|
-
*
|
|
107
|
+
* Clear the log sink and remove global log listeners.
|
|
108
|
+
* Safe to call before re-initializing with `init`.
|
|
107
109
|
*/
|
|
108
110
|
function clear() {
|
|
109
111
|
log?.clear();
|
|
110
112
|
logger_1.default.removeAllListeners('log');
|
|
111
113
|
}
|
|
112
|
-
//
|
|
113
|
-
const colorizeFormat = winston_1.format.colorize({
|
|
114
|
-
colors: COLORS_MAP,
|
|
115
|
-
});
|
|
116
|
-
// Strip the color marking within messages
|
|
117
|
-
const stripColorFormat = (0, winston_1.format)(function stripColor(info) {
|
|
118
|
-
return {
|
|
119
|
-
...info,
|
|
120
|
-
level: stripColorCodes(info.level),
|
|
121
|
-
message: lodash_1.default.isString(info.message) ? stripColorCodes(info.message) : info.message,
|
|
122
|
-
};
|
|
123
|
-
})();
|
|
124
|
-
/**
|
|
125
|
-
*
|
|
126
|
-
* @param {ParsedArgs} args
|
|
127
|
-
* @param {string} logLvl
|
|
128
|
-
* @returns {transports.ConsoleTransportInstance}
|
|
129
|
-
*/
|
|
114
|
+
// #region private helpers
|
|
130
115
|
function createConsoleTransport(args, logLvl) {
|
|
131
|
-
/** @type {AppiumConsoleTransportOptions} */
|
|
132
116
|
const opt = {
|
|
133
|
-
name: 'console',
|
|
134
117
|
level: logLvl,
|
|
135
118
|
stderrLevels: ['error'],
|
|
136
119
|
format: winston_1.format.combine(formatTimestamp(args), isLogColorEnabled(args) ? colorizeFormat : stripColorFormat, formatLog(args, true)),
|
|
137
120
|
};
|
|
138
121
|
return new winston_1.transports.Console(opt);
|
|
139
122
|
}
|
|
140
|
-
/**
|
|
141
|
-
*
|
|
142
|
-
* @param {ParsedArgs} args
|
|
143
|
-
* @param {string} logLvl
|
|
144
|
-
* @returns {transports.FileTransportInstance}
|
|
145
|
-
*/
|
|
146
123
|
function createFileTransport(args, logLvl) {
|
|
147
|
-
/** @type {AppiumFileTransportOptions} */
|
|
148
124
|
const opt = {
|
|
149
|
-
name: 'file',
|
|
150
125
|
filename: args.logFile,
|
|
151
126
|
maxFiles: 1,
|
|
152
127
|
level: logLvl,
|
|
@@ -154,12 +129,6 @@ function createFileTransport(args, logLvl) {
|
|
|
154
129
|
};
|
|
155
130
|
return new winston_1.transports.File(opt);
|
|
156
131
|
}
|
|
157
|
-
/**
|
|
158
|
-
*
|
|
159
|
-
* @param {ParsedArgs} args
|
|
160
|
-
* @param {string} logLvl
|
|
161
|
-
* @returns {transports.HttpTransportInstance}
|
|
162
|
-
*/
|
|
163
132
|
function createHttpTransport(args, logLvl) {
|
|
164
133
|
let host = '127.0.0.1';
|
|
165
134
|
let port = 9003;
|
|
@@ -168,9 +137,7 @@ function createHttpTransport(args, logLvl) {
|
|
|
168
137
|
host = hostAndPort[0];
|
|
169
138
|
port = parseInt(hostAndPort[1], 10);
|
|
170
139
|
}
|
|
171
|
-
/** @type {AppiumHttpTransportOptions} */
|
|
172
140
|
const opt = {
|
|
173
|
-
name: 'http',
|
|
174
141
|
host,
|
|
175
142
|
port,
|
|
176
143
|
path: '/',
|
|
@@ -179,16 +146,9 @@ function createHttpTransport(args, logLvl) {
|
|
|
179
146
|
};
|
|
180
147
|
return new winston_1.transports.Http(opt);
|
|
181
148
|
}
|
|
182
|
-
/**
|
|
183
|
-
*
|
|
184
|
-
* @param {ParsedArgs} args
|
|
185
|
-
* @returns {Promise<import('winston-transport')[]>}
|
|
186
|
-
*/
|
|
187
149
|
async function createTransports(args) {
|
|
188
|
-
const
|
|
189
|
-
/** @type {string} */
|
|
150
|
+
const transportList = [];
|
|
190
151
|
let consoleLogLevel;
|
|
191
|
-
/** @type {string} */
|
|
192
152
|
let fileLogLevel;
|
|
193
153
|
// Server args are normalized in main so we only see dest form (`loglevel`).
|
|
194
154
|
// Fall back to schema default so Winston never sees undefined.
|
|
@@ -201,7 +161,7 @@ async function createTransports(args) {
|
|
|
201
161
|
else {
|
|
202
162
|
consoleLogLevel = fileLogLevel = rawLogLevel;
|
|
203
163
|
}
|
|
204
|
-
|
|
164
|
+
transportList.push(createConsoleTransport(args, consoleLogLevel));
|
|
205
165
|
if (args.logFile) {
|
|
206
166
|
try {
|
|
207
167
|
// if we don't delete the log file, winston will always append and it will grow infinitely large;
|
|
@@ -210,30 +170,28 @@ async function createTransports(args) {
|
|
|
210
170
|
if (await support_1.fs.exists(args.logFile)) {
|
|
211
171
|
await support_1.fs.unlink(args.logFile);
|
|
212
172
|
}
|
|
213
|
-
|
|
173
|
+
transportList.push(createFileTransport(args, fileLogLevel));
|
|
214
174
|
}
|
|
215
175
|
catch (e) {
|
|
176
|
+
const err = e;
|
|
216
177
|
// eslint-disable-next-line no-console
|
|
217
|
-
console.log(`Tried to attach logging to file '${args.logFile}' but an error ` +
|
|
178
|
+
console.log(`Tried to attach logging to file '${args.logFile}' but an error ` +
|
|
179
|
+
`occurred: ${err.message}`);
|
|
218
180
|
}
|
|
219
181
|
}
|
|
220
182
|
if (args.webhook) {
|
|
221
183
|
try {
|
|
222
|
-
|
|
184
|
+
transportList.push(createHttpTransport(args, fileLogLevel));
|
|
223
185
|
}
|
|
224
186
|
catch (e) {
|
|
187
|
+
const err = e;
|
|
225
188
|
// eslint-disable-next-line no-console
|
|
226
189
|
console.log(`Tried to attach logging to Http at ${args.webhook} but ` +
|
|
227
|
-
`an error occurred: ${
|
|
190
|
+
`an error occurred: ${err.message}`);
|
|
228
191
|
}
|
|
229
192
|
}
|
|
230
|
-
return
|
|
193
|
+
return transportList;
|
|
231
194
|
}
|
|
232
|
-
/**
|
|
233
|
-
*
|
|
234
|
-
* @param {string} text
|
|
235
|
-
* @returns {string}
|
|
236
|
-
*/
|
|
237
195
|
function toDecoratedPrefix(text) {
|
|
238
196
|
return `[${text}]`;
|
|
239
197
|
}
|
|
@@ -241,26 +199,18 @@ function toDecoratedPrefix(text) {
|
|
|
241
199
|
* Selects the color of the text in terminal from the MIN_COLOR..MAX_COLOR
|
|
242
200
|
* range. We use adler32 hashing to ensure that equal prefixes would always have
|
|
243
201
|
* same colors.
|
|
244
|
-
*
|
|
245
|
-
* @param {string} text Initial text
|
|
246
|
-
* @returns {string} Colorized text (with pseudocode cchars added)
|
|
247
202
|
*/
|
|
248
203
|
function colorizePrefix(text) {
|
|
249
204
|
let colorIndex = COLORS_CACHE.get(text);
|
|
250
205
|
if (!colorIndex) {
|
|
251
206
|
const hash = (0, utils_1.adler32)(text);
|
|
252
|
-
colorIndex = MIN_COLOR + hash % (MAX_COLOR - MIN_COLOR);
|
|
207
|
+
colorIndex = MIN_COLOR + (hash % (MAX_COLOR - MIN_COLOR));
|
|
253
208
|
COLORS_CACHE.set(text, colorIndex);
|
|
254
209
|
}
|
|
255
210
|
return `\x1b[38;5;${colorIndex}m${text}\x1b[0m`;
|
|
256
211
|
}
|
|
257
|
-
/**
|
|
258
|
-
* @param {ParsedArgs} args
|
|
259
|
-
* @param {boolean} targetConsole
|
|
260
|
-
* @returns {import('logform').Format}
|
|
261
|
-
*/
|
|
262
212
|
function formatLog(args, targetConsole) {
|
|
263
|
-
if (['json', 'pretty_json'].includes(args.logFormat)) {
|
|
213
|
+
if (['json', 'pretty_json'].includes(args.logFormat ?? '')) {
|
|
264
214
|
return winston_1.format.combine((0, winston_1.format)((info) => {
|
|
265
215
|
const infoCopy = { ...info };
|
|
266
216
|
const contextInfo = logger_1.default.asyncStorage.getStore() ?? {};
|
|
@@ -280,12 +230,7 @@ function formatLog(args, targetConsole) {
|
|
|
280
230
|
return `${info.timestamp} ${info.message}`;
|
|
281
231
|
});
|
|
282
232
|
}
|
|
283
|
-
/**
|
|
284
|
-
* add the timestamp in the correct format to the log info object
|
|
285
|
-
*
|
|
286
|
-
* @param {ParsedArgs} args
|
|
287
|
-
* @returns {import('logform').Format}
|
|
288
|
-
*/
|
|
233
|
+
/** Add the timestamp in the correct format to the log info object. */
|
|
289
234
|
function formatTimestamp(args) {
|
|
290
235
|
return winston_1.format.timestamp({
|
|
291
236
|
format() {
|
|
@@ -298,29 +243,29 @@ function formatTimestamp(args) {
|
|
|
298
243
|
},
|
|
299
244
|
});
|
|
300
245
|
}
|
|
246
|
+
// set the custom colors
|
|
247
|
+
const colorizeFormat = winston_1.format.colorize({
|
|
248
|
+
colors: COLORS_MAP,
|
|
249
|
+
});
|
|
301
250
|
/**
|
|
302
|
-
* Strips color control codes from
|
|
251
|
+
* Strips ANSI color control codes from a string.
|
|
303
252
|
*
|
|
304
|
-
* @param
|
|
305
|
-
* @returns
|
|
253
|
+
* @param text - String that may contain escape codes (e.g. `\u001b[31m`).
|
|
254
|
+
* @returns The string with all color codes removed.
|
|
306
255
|
*/
|
|
307
256
|
function stripColorCodes(text) {
|
|
308
257
|
return text.replace(COLOR_CODE_PATTERN, '');
|
|
309
258
|
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
259
|
+
// Strip the color marking within messages (depends on stripColorCodes)
|
|
260
|
+
const stripColorFormat = (0, winston_1.format)(function stripColor(info) {
|
|
261
|
+
return {
|
|
262
|
+
...info,
|
|
263
|
+
level: stripColorCodes(info.level),
|
|
264
|
+
message: lodash_1.default.isString(info.message) ? stripColorCodes(info.message) : info.message,
|
|
265
|
+
};
|
|
266
|
+
})();
|
|
315
267
|
function isLogColorEnabled(args) {
|
|
316
268
|
return !args.logNoColors && args.logFormat === 'text';
|
|
317
269
|
}
|
|
318
|
-
|
|
319
|
-
/**
|
|
320
|
-
* @typedef {import('appium/types').ParsedArgs} ParsedArgs
|
|
321
|
-
* @typedef {import('@appium/logger').MessageObject} MessageObject
|
|
322
|
-
* @typedef {transports.ConsoleTransportOptions & {name: string}} AppiumConsoleTransportOptions
|
|
323
|
-
* @typedef {transports.FileTransportOptions & {name: string}} AppiumFileTransportOptions
|
|
324
|
-
* @typedef {transports.HttpTransportOptions & {name: string}} AppiumHttpTransportOptions
|
|
325
|
-
*/
|
|
270
|
+
// #endregion
|
|
326
271
|
//# sourceMappingURL=logsink.js.map
|
package/build/lib/logsink.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logsink.js","sourceRoot":"","sources":["../../lib/logsink.
|
|
1
|
+
{"version":3,"file":"logsink.js","sourceRoot":"","sources":["../../lib/logsink.ts"],"names":[],"mappings":";;;;;AAqDA,oBAuDC;AAMD,sBAGC;AA4LD,0CAEC;AA/SD,4DAAuC;AACvC,qCAAyD;AACzD,6CAAmC;AACnC,oDAAuB;AACvB,mCAAgC;AAChC,yCAAmC;AAEnC,MAAM,UAAU,GAAG;IACjB,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,CAAC;CACA,CAAC;AACX,MAAM,UAAU,GAAG;IACjB,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,KAAK;CACJ,CAAC;AACX,MAAM,qBAAqB,GAAG;IAC5B,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,OAAO;IAChB,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;CACN,CAAC;AACX,MAAM,kBAAkB,GAAG,yBAAyB,CAAC,CAAC,uCAAuC;AAE7F,4DAA4D;AAC5D,MAAM,SAAS,GAAG,EAAE,CAAC;AACrB,MAAM,SAAS,GAAG,GAAG,CAAC;AACtB,MAAM,YAAY,GAAG,IAAI,oBAAQ,CAAiB;IAChD,GAAG,EAAE,IAAI;IACT,GAAG,EAAE,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,wBAAwB;IAClD,cAAc,EAAE,IAAI;CACrB,CAAC,CAAC;AAEH,yFAAyF;AACzF,IAAI,GAAG,GAAkB,IAAI,CAAC;AAE9B;;;;;;GAMG;AACI,KAAK,UAAU,IAAI,CAAC,IAAgB;IACzC,gBAAS,CAAC,KAAK,GAAG,QAAQ,CAAC;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AI,CAAC,iBAAiB,EAAE,GAAG,KAAK,CAAC,CAAC;YACrE,CAAC;YACD,0DAA0D;YAC1D,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;QAC7E,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAED,wBAAwB;AACxB,MAAM,cAAc,GAAG,gBAAM,CAAC,QAAQ,CAAC;IACrC,MAAM,EAAE,UAAU;CACnB,CAAC,CAAC;AAEH;;;;;GAKG;AACH,SAAgB,eAAe,CAAC,IAAY;IAC1C,OAAO,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAC;AAC9C,CAAC;AAED,uEAAuE;AACvE,MAAM,gBAAgB,GAAG,IAAA,gBAAM,EAAC,SAAS,UAAU,CAAC,IAA+D;IACjH,OAAO;QACL,GAAG,IAAI;QACP,KAAK,EAAE,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC;QAClC,OAAO,EAAE,gBAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO;KACjF,CAAC;AACJ,CAAC,CAAC,EAAE,CAAC;AAEL,SAAS,iBAAiB,CAAC,IAAgB;IACzC,OAAO,CAAC,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,SAAS,KAAK,MAAM,CAAC;AACxD,CAAC;AACD,aAAa"}
|
package/build/lib/main.d.ts
CHANGED
|
@@ -1,67 +1,24 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export type CliCommand = import("appium/types").CliCommand;
|
|
8
|
-
export type CliExtensionSubcommand = import("appium/types").CliExtensionSubcommand;
|
|
9
|
-
export type CliExtensionCommand = import("appium/types").CliExtensionCommand;
|
|
10
|
-
export type ServerCommand = import("appium/types").CliCommandServer;
|
|
11
|
-
export type DriverCommand = import("appium/types").CliCommandDriver;
|
|
12
|
-
export type PluginCommand = import("appium/types").CliCommandPlugin;
|
|
13
|
-
export type SetupCommand = import("appium/types").CliCommandSetup;
|
|
14
|
-
export type DriverNameMap = import("./extension").DriverNameMap;
|
|
15
|
-
export type PluginNameMap = import("./extension").PluginNameMap;
|
|
16
|
-
/**
|
|
17
|
-
* Literally an empty object
|
|
18
|
-
*/
|
|
19
|
-
export type ExtCommandInitResult = {};
|
|
20
|
-
export type ServerInitData = {
|
|
21
|
-
/**
|
|
22
|
-
* - The Appium driver
|
|
23
|
-
*/
|
|
24
|
-
appiumDriver: import("./appium").AppiumDriver;
|
|
25
|
-
/**
|
|
26
|
-
* - The parsed arguments
|
|
27
|
-
*/
|
|
28
|
-
parsedArgs: import("appium/types").ParsedArgs;
|
|
29
|
-
/**
|
|
30
|
-
* - The full path to the Appium home folder
|
|
31
|
-
*/
|
|
32
|
-
appiumHome: string;
|
|
33
|
-
};
|
|
34
|
-
export type InitResult<Cmd extends CliCommand> = Cmd extends ServerCommand ? ServerInitData & import("./extension").ExtensionConfigs : ExtCommandInitResult;
|
|
35
|
-
export type Args<Cmd extends CliCommand = "server", SubCmd extends CliExtensionSubcommand | void = void> = import("appium/types").Args<Cmd, SubCmd>;
|
|
36
|
-
export type ParsedArgs<Cmd extends CliCommand = "server", SubCmd extends CliExtensionSubcommand | void = void> = import("appium/types").ParsedArgs<Cmd, SubCmd>;
|
|
37
|
-
/**
|
|
38
|
-
* Initializes Appium's config. Starts server if appropriate and resolves the
|
|
39
|
-
* server instance if so; otherwise resolves w/ `undefined`.
|
|
40
|
-
* @template {CliCommand} [Cmd=ServerCommand]
|
|
41
|
-
* @template {CliExtensionSubcommand|void} [SubCmd=void]
|
|
42
|
-
* @param {Args<Cmd, SubCmd>} [args] - Arguments from CLI or otherwise
|
|
43
|
-
* @returns {Promise<Cmd extends ServerCommand ? import('@appium/types').AppiumServer : void>}
|
|
44
|
-
*/
|
|
45
|
-
export function main<Cmd extends CliCommand = "server", SubCmd extends CliExtensionSubcommand | void = void>(args?: Args<Cmd, SubCmd>): Promise<Cmd extends ServerCommand ? import("@appium/types").AppiumServer : void>;
|
|
2
|
+
import './logsink';
|
|
3
|
+
import './logger';
|
|
4
|
+
import type { AppiumServer } from '@appium/types';
|
|
5
|
+
import type { Args, CliCommand, CliCommandServer, CliCommandSetupSubcommand, CliExtensionSubcommand } from 'appium/types';
|
|
6
|
+
import type { ExtCommandInitResult, InitResult, ServerInitData } from './bootstrap/init-types';
|
|
46
7
|
/**
|
|
47
8
|
* Initializes Appium, but does not start the server.
|
|
48
9
|
*
|
|
49
10
|
* Use this to get at the configuration schema.
|
|
50
11
|
*
|
|
51
12
|
* If `args` contains a non-empty `subcommand` which is not `server`, this function will return an empty object.
|
|
52
|
-
*
|
|
53
|
-
* @template {CliCommand} [Cmd=ServerCommand]
|
|
54
|
-
* @template {CliExtensionSubcommand|void} [SubCmd=void]
|
|
55
|
-
* @param {Args<Cmd, SubCmd>} [args] - Partial args (programmatic usage only)
|
|
56
|
-
* @returns {Promise<InitResult<Cmd>>}
|
|
57
|
-
* @example
|
|
58
|
-
* import {init, getSchema} from 'appium';
|
|
59
|
-
* const options = {}; // config object
|
|
60
|
-
* await init(options);
|
|
61
|
-
* const schema = getSchema(); // entire config schema including plugins and drivers
|
|
62
13
|
*/
|
|
63
|
-
export function init<Cmd extends CliCommand =
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
14
|
+
export declare function init<Cmd extends CliCommand = CliCommandServer, SubCmd extends CliExtensionSubcommand | CliCommandSetupSubcommand | void = void>(args?: Args<Cmd, SubCmd>): Promise<InitResult<Cmd>>;
|
|
15
|
+
/**
|
|
16
|
+
* Initializes Appium's config. Starts server if appropriate and resolves the
|
|
17
|
+
* server instance if so; otherwise resolves with `undefined`.
|
|
18
|
+
*/
|
|
19
|
+
export declare function main<Cmd extends CliCommand = CliCommandServer, SubCmd extends CliExtensionSubcommand | CliCommandSetupSubcommand | void = void>(args?: Args<Cmd, SubCmd>): Promise<Cmd extends CliCommandServer ? AppiumServer : void>;
|
|
20
|
+
export { readConfigFile } from './bootstrap/config-file';
|
|
21
|
+
export { finalizeSchema, getSchema, validate } from './schema/schema';
|
|
22
|
+
export declare const resolveAppiumHome: ((cwd?: string) => Promise<string>) & import("lodash").MemoizedFunction;
|
|
23
|
+
export type { ExtCommandInitResult, InitResult, ServerInitData };
|
|
67
24
|
//# sourceMappingURL=main.d.ts.map
|
package/build/lib/main.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../lib/main.
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../lib/main.ts"],"names":[],"mappings":";AAEA,OAAO,WAAW,CAAC;AACnB,OAAO,UAAU,CAAC;AAElB,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EACV,IAAI,EACJ,UAAU,EACV,gBAAgB,EAChB,yBAAyB,EACzB,sBAAsB,EACvB,MAAM,cAAc,CAAC;AAGtB,OAAO,KAAK,EAAC,oBAAoB,EAAE,UAAU,EAAE,cAAc,EAAC,MAAM,wBAAwB,CAAC;AAK7F;;;;;;GAMG;AACH,wBAAsB,IAAI,CACxB,GAAG,SAAS,UAAU,GAAG,gBAAgB,EACzC,MAAM,SAAS,sBAAsB,GAAG,yBAAyB,GAAG,IAAI,GAAG,IAAI,EAC/E,IAAI,CAAC,EAAE,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAEpD;AAED;;;GAGG;AACH,wBAAsB,IAAI,CACxB,GAAG,SAAS,UAAU,GAAG,gBAAgB,EACzC,MAAM,SAAS,sBAAsB,GAAG,yBAAyB,GAAG,IAAI,GAAG,IAAI,EAC/E,IAAI,CAAC,EAAE,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,GAAG,SAAS,gBAAgB,GAAG,YAAY,GAAG,IAAI,CAAC,CAGvF;AAWD,OAAO,EAAC,cAAc,EAAC,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAC,cAAc,EAAE,SAAS,EAAE,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AACpE,eAAO,MAAM,iBAAiB,yEAAwB,CAAC;AAEvD,YAAY,EAAC,oBAAoB,EAAE,UAAU,EAAE,cAAc,EAAC,CAAC"}
|