appium 3.3.0 → 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} +9 -26
- 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/{grid-register.js → bootstrap/grid-v3-register.js} +28 -13
- 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.map +1 -1
- package/build/lib/cli/args.js +9 -9
- package/build/lib/cli/args.js.map +1 -1
- package/build/lib/cli/extension-command.d.ts +95 -95
- package/build/lib/cli/extension-command.d.ts.map +1 -1
- package/build/lib/cli/extension-command.js +18 -18
- package/build/lib/cli/extension-command.js.map +1 -1
- package/build/lib/cli/extension.d.ts +1 -1
- package/build/lib/cli/extension.d.ts.map +1 -1
- package/build/lib/cli/extension.js +5 -5
- package/build/lib/cli/extension.js.map +1 -1
- package/build/lib/cli/parser.d.ts +8 -8
- package/build/lib/cli/parser.d.ts.map +1 -1
- package/build/lib/cli/parser.js +49 -49
- package/build/lib/cli/parser.js.map +1 -1
- package/build/lib/cli/setup-command.js +6 -6
- package/build/lib/cli/setup-command.js.map +1 -1
- package/build/lib/cli/utils.d.ts +17 -17
- package/build/lib/cli/utils.d.ts.map +1 -1
- package/build/lib/cli/utils.js +29 -29
- package/build/lib/cli/utils.js.map +1 -1
- package/build/lib/doctor/doctor.d.ts +2 -2
- package/build/lib/doctor/doctor.d.ts.map +1 -1
- package/build/lib/doctor/doctor.js +6 -6
- 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/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/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.js +2 -2
- package/build/lib/schema/cli-args.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 +2 -0
- 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/schema.d.ts +15 -15
- package/build/lib/schema/schema.d.ts.map +1 -1
- package/build/lib/schema/schema.js +37 -37
- package/build/lib/schema/schema.js.map +1 -1
- package/build/lib/utils.d.ts +0 -81
- package/build/lib/utils.d.ts.map +1 -1
- package/build/lib/utils.js +1 -248
- 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/{config-file.ts → bootstrap/config-file.ts} +29 -63
- package/lib/{grid-register.ts → bootstrap/grid-v3-register.ts} +35 -35
- 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.ts +10 -10
- package/lib/cli/extension-command.ts +132 -132
- package/lib/cli/extension.ts +7 -7
- package/lib/cli/parser.ts +50 -50
- package/lib/cli/setup-command.ts +2 -2
- package/lib/cli/utils.ts +33 -33
- package/lib/doctor/doctor.ts +8 -8
- 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/main.ts +60 -0
- package/lib/schema/cli-args-guards.ts +67 -0
- package/lib/schema/cli-args.ts +1 -1
- package/lib/schema/format-errors.ts +43 -0
- package/lib/schema/index.ts +2 -0
- package/lib/schema/schema.ts +51 -52
- package/lib/utils.ts +0 -331
- package/package.json +12 -13
- package/scripts/autoinstall-extensions.js +3 -0
- package/build/lib/config-file.d.ts +0 -57
- 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 -68
- package/build/lib/config.d.ts.map +0 -1
- package/build/lib/config.js +0 -358
- package/build/lib/config.js.map +0 -1
- package/build/lib/grid-register.d.ts +0 -35
- package/build/lib/grid-register.d.ts.map +0 -1
- package/build/lib/grid-register.js.map +0 -1
- package/lib/config.ts +0 -377
- 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/main.js +0 -545
package/build/lib/utils.js
CHANGED
|
@@ -3,126 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getAppiumModuleRoot = exports.
|
|
7
|
-
exports.makeNonW3cCapsError = makeNonW3cCapsError;
|
|
8
|
-
exports.parseCapsForInnerDriver = parseCapsForInnerDriver;
|
|
9
|
-
exports.insertAppiumPrefixes = insertAppiumPrefixes;
|
|
10
|
-
exports.removeAppiumPrefixes = removeAppiumPrefixes;
|
|
11
|
-
exports.adjustNodePath = adjustNodePath;
|
|
12
|
-
exports.pullSettings = pullSettings;
|
|
13
|
-
exports.isServerCommandArgs = isServerCommandArgs;
|
|
14
|
-
exports.isSetupCommandArgs = isSetupCommandArgs;
|
|
15
|
-
exports.isExtensionCommandArgs = isExtensionCommandArgs;
|
|
16
|
-
exports.isDriverCommandArgs = isDriverCommandArgs;
|
|
17
|
-
exports.isPluginCommandArgs = isPluginCommandArgs;
|
|
18
|
-
exports.fetchInterfaces = fetchInterfaces;
|
|
6
|
+
exports.getAppiumModuleRoot = exports.npmPackage = void 0;
|
|
19
7
|
exports.adler32 = adler32;
|
|
20
|
-
exports.isBroadcastIp = isBroadcastIp;
|
|
21
8
|
const lodash_1 = __importDefault(require("lodash"));
|
|
22
|
-
const logger_1 = __importDefault(require("./logger"));
|
|
23
|
-
const base_driver_1 = require("@appium/base-driver");
|
|
24
|
-
const node_util_1 = require("node:util");
|
|
25
9
|
const support_1 = require("@appium/support");
|
|
26
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
27
|
-
const constants_1 = require("./constants");
|
|
28
|
-
const node_os_1 = __importDefault(require("node:os"));
|
|
29
|
-
const W3C_APPIUM_PREFIX = 'appium';
|
|
30
|
-
const STANDARD_CAPS_LOWERCASE = new Set([...base_driver_1.STANDARD_CAPS].map((cap) => cap.toLowerCase()));
|
|
31
|
-
exports.V4_BROADCAST_IP = '0.0.0.0';
|
|
32
|
-
exports.V6_BROADCAST_IP = '::';
|
|
33
10
|
exports.npmPackage = support_1.fs.readPackageJsonFrom(__dirname);
|
|
34
|
-
/** If stdout is a TTY; used for tighter control over log output. */
|
|
35
|
-
const isStdoutTTY = process.stdout.isTTY;
|
|
36
|
-
/**
|
|
37
|
-
* Creates an error when a session receives non-W3C capabilities.
|
|
38
|
-
*/
|
|
39
|
-
function makeNonW3cCapsError() {
|
|
40
|
-
return new base_driver_1.errors.SessionNotCreatedError('Session capabilities format must comply to the W3C standard. Make sure your client is up to date. ' +
|
|
41
|
-
'See https://www.w3.org/TR/webdriver/#new-session for more details.');
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Logs a value to the console using the info logger (with util.inspect formatting).
|
|
45
|
-
*/
|
|
46
|
-
exports.inspect = lodash_1.default.flow(lodash_1.default.partialRight(node_util_1.inspect, {
|
|
47
|
-
colors: true,
|
|
48
|
-
depth: null,
|
|
49
|
-
compact: !isStdoutTTY,
|
|
50
|
-
}), (...args) => {
|
|
51
|
-
logger_1.default.info(...args);
|
|
52
|
-
});
|
|
53
|
-
/**
|
|
54
|
-
* Parses W3C capabilities for the inner driver and applies defaults.
|
|
55
|
-
*
|
|
56
|
-
* @returns Parsed caps or an invalid result with an error.
|
|
57
|
-
*/
|
|
58
|
-
function parseCapsForInnerDriver(w3cCapabilities, constraints = {}, defaultCapabilities = {}) {
|
|
59
|
-
if (!(0, base_driver_1.isW3cCaps)(w3cCapabilities)) {
|
|
60
|
-
return { error: makeNonW3cCapsError() };
|
|
61
|
-
}
|
|
62
|
-
let desiredCaps = {};
|
|
63
|
-
// eslint-disable-next-line prefer-const -- assigned in success path after try
|
|
64
|
-
let processedW3CCapabilities;
|
|
65
|
-
w3cCapabilities = lodash_1.default.cloneDeep(w3cCapabilities);
|
|
66
|
-
defaultCapabilities = lodash_1.default.cloneDeep(defaultCapabilities);
|
|
67
|
-
if (!lodash_1.default.isEmpty(defaultCapabilities)) {
|
|
68
|
-
for (const [defaultCapKey, defaultCapValue] of lodash_1.default.toPairs(defaultCapabilities)) {
|
|
69
|
-
let isCapAlreadySet = false;
|
|
70
|
-
for (const firstMatchEntry of w3cCapabilities.firstMatch ?? []) {
|
|
71
|
-
if (lodash_1.default.isPlainObject(firstMatchEntry) &&
|
|
72
|
-
lodash_1.default.has(removeAppiumPrefixes(firstMatchEntry), removeAppiumPrefix(defaultCapKey))) {
|
|
73
|
-
isCapAlreadySet = true;
|
|
74
|
-
break;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
isCapAlreadySet =
|
|
78
|
-
isCapAlreadySet ||
|
|
79
|
-
(lodash_1.default.isPlainObject(w3cCapabilities.alwaysMatch) &&
|
|
80
|
-
lodash_1.default.has(removeAppiumPrefixes(w3cCapabilities.alwaysMatch), removeAppiumPrefix(defaultCapKey)));
|
|
81
|
-
if (isCapAlreadySet) {
|
|
82
|
-
continue;
|
|
83
|
-
}
|
|
84
|
-
if (lodash_1.default.isEmpty(w3cCapabilities.firstMatch)) {
|
|
85
|
-
w3cCapabilities.firstMatch = [{ [defaultCapKey]: defaultCapValue }];
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
w3cCapabilities.firstMatch[0][defaultCapKey] = defaultCapValue;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
try {
|
|
93
|
-
desiredCaps = (0, base_driver_1.processCapabilities)(w3cCapabilities, constraints, true);
|
|
94
|
-
}
|
|
95
|
-
catch (error) {
|
|
96
|
-
logger_1.default.info(`Could not parse W3C capabilities: ${error.message}`);
|
|
97
|
-
return {
|
|
98
|
-
desiredCaps,
|
|
99
|
-
processedW3CCapabilities,
|
|
100
|
-
error: error,
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
processedW3CCapabilities = {
|
|
104
|
-
alwaysMatch: { ...insertAppiumPrefixes(desiredCaps) },
|
|
105
|
-
firstMatch: [{}],
|
|
106
|
-
};
|
|
107
|
-
return {
|
|
108
|
-
desiredCaps,
|
|
109
|
-
processedW3CCapabilities,
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Prefixes capability keys with `appium:` where appropriate.
|
|
114
|
-
*/
|
|
115
|
-
function insertAppiumPrefixes(caps) {
|
|
116
|
-
return lodash_1.default.mapKeys(caps, (_, key) => STANDARD_CAPS_LOWERCASE.has(key.toLowerCase()) || key.includes(':')
|
|
117
|
-
? key
|
|
118
|
-
: `${W3C_APPIUM_PREFIX}:${key}`);
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Removes `appium:` prefix from capability keys.
|
|
122
|
-
*/
|
|
123
|
-
function removeAppiumPrefixes(caps) {
|
|
124
|
-
return lodash_1.default.mapKeys(caps, (_, key) => removeAppiumPrefix(key));
|
|
125
|
-
}
|
|
126
11
|
/**
|
|
127
12
|
* Returns the root directory of the Appium module (memoized).
|
|
128
13
|
*
|
|
@@ -135,126 +20,6 @@ exports.getAppiumModuleRoot = lodash_1.default.memoize(function getAppiumModuleR
|
|
|
135
20
|
}
|
|
136
21
|
return selfRoot;
|
|
137
22
|
});
|
|
138
|
-
/**
|
|
139
|
-
* Adjusts NODE_PATH so CJS drivers/plugins can load peer deps. Does not work with ESM.
|
|
140
|
-
*/
|
|
141
|
-
function adjustNodePath() {
|
|
142
|
-
let appiumModuleSearchRoot;
|
|
143
|
-
try {
|
|
144
|
-
appiumModuleSearchRoot = node_path_1.default.dirname((0, exports.getAppiumModuleRoot)());
|
|
145
|
-
}
|
|
146
|
-
catch (error) {
|
|
147
|
-
logger_1.default.warn(error.message);
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
const refreshRequirePaths = () => {
|
|
151
|
-
try {
|
|
152
|
-
// Private API; see https://gist.github.com/branneman/8048520#7-the-hack
|
|
153
|
-
require('node:module').Module._initPaths();
|
|
154
|
-
return true;
|
|
155
|
-
}
|
|
156
|
-
catch {
|
|
157
|
-
return false;
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
if (!process.env.NODE_PATH) {
|
|
161
|
-
process.env.NODE_PATH = appiumModuleSearchRoot;
|
|
162
|
-
if (refreshRequirePaths()) {
|
|
163
|
-
process.env.APPIUM_OMIT_PEER_DEPS = '1';
|
|
164
|
-
}
|
|
165
|
-
else {
|
|
166
|
-
delete process.env.NODE_PATH;
|
|
167
|
-
}
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
const nodePathParts = process.env.NODE_PATH.split(node_path_1.default.delimiter);
|
|
171
|
-
if (nodePathParts.includes(appiumModuleSearchRoot)) {
|
|
172
|
-
process.env.APPIUM_OMIT_PEER_DEPS = '1';
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
nodePathParts.push(appiumModuleSearchRoot);
|
|
176
|
-
process.env.NODE_PATH = nodePathParts.join(node_path_1.default.delimiter);
|
|
177
|
-
if (refreshRequirePaths()) {
|
|
178
|
-
process.env.APPIUM_OMIT_PEER_DEPS = '1';
|
|
179
|
-
}
|
|
180
|
-
else {
|
|
181
|
-
process.env.NODE_PATH = lodash_1.default.without(nodePathParts, appiumModuleSearchRoot).join(node_path_1.default.delimiter);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Pulls Appium settings from capabilities (mutates caps). Supports
|
|
186
|
-
* `settings[key]: value` and `settings: { key: value }`.
|
|
187
|
-
*
|
|
188
|
-
* @returns Parsed settings object; empty if none found.
|
|
189
|
-
*/
|
|
190
|
-
function pullSettings(caps) {
|
|
191
|
-
if (!lodash_1.default.isPlainObject(caps) || lodash_1.default.isEmpty(caps)) {
|
|
192
|
-
return {};
|
|
193
|
-
}
|
|
194
|
-
const result = {};
|
|
195
|
-
const singleSettings = {};
|
|
196
|
-
for (const [key, value] of lodash_1.default.toPairs(caps)) {
|
|
197
|
-
let match;
|
|
198
|
-
if (/^(s|appium:s)ettings$/.test(key) && lodash_1.default.isPlainObject(value)) {
|
|
199
|
-
Object.assign(result, value);
|
|
200
|
-
delete caps[key];
|
|
201
|
-
}
|
|
202
|
-
else if ((match = /^(s|appium:s)ettings\[(\S+)\]$/.exec(key))) {
|
|
203
|
-
singleSettings[match[2]] = value;
|
|
204
|
-
delete caps[key];
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
if (!lodash_1.default.isEmpty(singleSettings)) {
|
|
208
|
-
Object.assign(result, singleSettings);
|
|
209
|
-
}
|
|
210
|
-
return result;
|
|
211
|
-
}
|
|
212
|
-
/**
|
|
213
|
-
* Type guard: args are for the server command.
|
|
214
|
-
*/
|
|
215
|
-
function isServerCommandArgs(args) {
|
|
216
|
-
return args.subcommand === constants_1.SERVER_SUBCOMMAND;
|
|
217
|
-
}
|
|
218
|
-
/**
|
|
219
|
-
* Type guard: args are for the setup command.
|
|
220
|
-
*/
|
|
221
|
-
function isSetupCommandArgs(args) {
|
|
222
|
-
return args.subcommand === constants_1.SETUP_SUBCOMMAND;
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* Type guard: args are for an extension command (driver or plugin).
|
|
226
|
-
*/
|
|
227
|
-
function isExtensionCommandArgs(args) {
|
|
228
|
-
return args.subcommand === constants_1.DRIVER_TYPE || args.subcommand === constants_1.PLUGIN_TYPE;
|
|
229
|
-
}
|
|
230
|
-
/**
|
|
231
|
-
* Type guard: args are for a driver extension command.
|
|
232
|
-
*/
|
|
233
|
-
function isDriverCommandArgs(args) {
|
|
234
|
-
return args.subcommand === constants_1.DRIVER_TYPE;
|
|
235
|
-
}
|
|
236
|
-
/**
|
|
237
|
-
* Type guard: args are for a plugin extension command.
|
|
238
|
-
*/
|
|
239
|
-
function isPluginCommandArgs(args) {
|
|
240
|
-
return args.subcommand === constants_1.PLUGIN_TYPE;
|
|
241
|
-
}
|
|
242
|
-
/**
|
|
243
|
-
* Returns network interfaces for the given IP family.
|
|
244
|
-
*
|
|
245
|
-
* @param family - 4 for IPv4, 6 for IPv6, or null for all.
|
|
246
|
-
*/
|
|
247
|
-
function fetchInterfaces(family = null) {
|
|
248
|
-
let familyValue = null;
|
|
249
|
-
if (family === 4) {
|
|
250
|
-
familyValue = [4, 'IPv4'];
|
|
251
|
-
}
|
|
252
|
-
else if (family === 6) {
|
|
253
|
-
familyValue = [6, 'IPv6'];
|
|
254
|
-
}
|
|
255
|
-
const ifaces = lodash_1.default.values(node_os_1.default.networkInterfaces()).filter(Boolean);
|
|
256
|
-
return lodash_1.default.flatMap(ifaces).filter((info) => !familyValue || familyValue.includes(info.family));
|
|
257
|
-
}
|
|
258
23
|
/**
|
|
259
24
|
* Adler-32 checksum (see https://github.com/SheetJS/js-adler32).
|
|
260
25
|
*/
|
|
@@ -309,16 +74,4 @@ function adler32(str, seed = null) {
|
|
|
309
74
|
}
|
|
310
75
|
return ((b % 65521) << 16) | (a % 65521);
|
|
311
76
|
}
|
|
312
|
-
/**
|
|
313
|
-
* Returns true if the address is a broadcast IP (0.0.0.0 or ::).
|
|
314
|
-
*/
|
|
315
|
-
function isBroadcastIp(address) {
|
|
316
|
-
return [exports.V4_BROADCAST_IP, exports.V6_BROADCAST_IP, `[${exports.V6_BROADCAST_IP}]`].includes(address);
|
|
317
|
-
}
|
|
318
|
-
// #region private helpers
|
|
319
|
-
function removeAppiumPrefix(key) {
|
|
320
|
-
const prefix = `${W3C_APPIUM_PREFIX}:`;
|
|
321
|
-
return lodash_1.default.startsWith(key, prefix) ? key.substring(prefix.length) : key;
|
|
322
|
-
}
|
|
323
|
-
// #endregion
|
|
324
77
|
//# sourceMappingURL=utils.js.map
|
package/build/lib/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../lib/utils.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../lib/utils.ts"],"names":[],"mappings":";;;;;;AAqBA,0BAmDC;AAxED,oDAAuB;AACvB,6CAAyC;AAE5B,QAAA,UAAU,GAAG,YAAE,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;AAE5D;;;;GAIG;AACU,QAAA,mBAAmB,GAAG,gBAAC,CAAC,OAAO,CAAC,SAAS,mBAAmB;IACvE,MAAM,QAAQ,GAAG,cAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IAC9D,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MA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