@appium/base-driver
Advanced tools
Comparing version 9.13.1 to 9.14.0
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const mixin_1 = require("./mixin"); | ||
const lodash_1 = __importDefault(require("lodash")); | ||
const BidiCommands = { | ||
@@ -20,4 +24,16 @@ async bidiSubscribe(events, contexts = ['']) { | ||
}, | ||
async bidiStatus() { | ||
const result = await this.getStatus(); | ||
if (!lodash_1.default.has(result, 'ready')) { | ||
//@ts-ignore This is OK | ||
result.ready = true; | ||
} | ||
if (!lodash_1.default.has(result, 'message')) { | ||
//@ts-ignore This is OK | ||
result.message = `${this.constructor.name} is ready to accept commands`; | ||
} | ||
return result; | ||
} | ||
}; | ||
(0, mixin_1.mixin)(BidiCommands); | ||
//# sourceMappingURL=bidi.js.map |
@@ -14,5 +14,4 @@ "use strict"; | ||
function mixin(mixin) { | ||
// eslint-disable-next-line no-restricted-syntax | ||
Object.assign(driver_1.BaseDriver.prototype, mixin); | ||
} | ||
//# sourceMappingURL=mixin.js.map |
@@ -66,5 +66,7 @@ "use strict"; | ||
// pageLoad | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
async pageLoadTimeoutW3C(ms) { | ||
throw new protocol_1.errors.NotImplementedError('Not implemented yet for pageLoad.'); | ||
}, | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
async pageLoadTimeoutMJSONWP(ms) { | ||
@@ -74,5 +76,7 @@ throw new protocol_1.errors.NotImplementedError('Not implemented yet for pageLoad.'); | ||
// script | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
async scriptTimeoutW3C(ms) { | ||
throw new protocol_1.errors.NotImplementedError('Not implemented yet for script.'); | ||
}, | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
async scriptTimeoutMJSONWP(ms) { | ||
@@ -86,3 +90,2 @@ throw new protocol_1.errors.NotImplementedError('Not implemented yet for script.'); | ||
setImplicitWait(ms) { | ||
// eslint-disable-line require-await | ||
this.implicitWaitMs = ms; | ||
@@ -89,0 +92,0 @@ this.log.debug(`Set implicit wait to ${ms}ms`); |
@@ -1,5 +0,5 @@ | ||
import type { AppiumLogger, Constraints, Core, Driver, DriverOpts, EventHistory, HTTPMethod, InitialOpts, Protocol, RouteMatcher, StringRecord } from '@appium/types'; | ||
import type { AppiumLogger, Constraints, Core, Driver, DriverOpts, EventHistory, HTTPMethod, InitialOpts, Protocol, RouteMatcher, StringRecord, BidiModuleMap, BiDiResultData } from '@appium/types'; | ||
import AsyncLock from 'async-lock'; | ||
import DeviceSettings from './device-settings'; | ||
import helpers from './helpers'; | ||
import { DeviceSettings } from './device-settings'; | ||
import * as helpers from './helpers'; | ||
export declare class DriverCore<const C extends Constraints, Settings extends StringRecord = StringRecord> implements Core<C, Settings> { | ||
@@ -52,2 +52,3 @@ /** | ||
doesSupportBidi: boolean; | ||
bidiCommands: BidiModuleMap; | ||
constructor(opts?: InitialOpts, shouldValidateCaps?: boolean); | ||
@@ -163,4 +164,5 @@ get log(): AppiumLogger; | ||
clearNewCommandTimeout(): Promise<void>; | ||
executeBidiCommand(bidiCmd: string, bidiParams: StringRecord): Promise<any>; | ||
updateBidiCommands(cmds: BidiModuleMap): void; | ||
executeBidiCommand(bidiCmd: string, bidiParams: StringRecord): Promise<BiDiResultData>; | ||
} | ||
//# sourceMappingURL=core.d.ts.map |
"use strict"; | ||
/* eslint-disable no-unused-vars */ | ||
/* eslint-disable require-await */ | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
@@ -49,4 +47,4 @@ if (k2 === undefined) k2 = k; | ||
const protocol_1 = require("../protocol"); | ||
const device_settings_1 = __importDefault(require("./device-settings")); | ||
const helpers_1 = __importStar(require("./helpers")); | ||
const device_settings_1 = require("./device-settings"); | ||
const helpers = __importStar(require("./helpers")); | ||
const bidi_commands_1 = require("../protocol/bidi-commands"); | ||
@@ -59,3 +57,4 @@ const NEW_COMMAND_TIMEOUT_MS = 60 * 1000; | ||
constructor(opts = {}, shouldValidateCaps = true) { | ||
this._log = support_1.logger.getLogger(helpers_1.default.generateDriverLogPrefix(this)); | ||
this.bidiCommands = bidi_commands_1.BIDI_COMMANDS; | ||
this._log = support_1.logger.getLogger(helpers.generateDriverLogPrefix(this)); | ||
// setup state | ||
@@ -71,3 +70,3 @@ this.opts = opts; | ||
this.sessionId = null; | ||
this.helpers = helpers_1.default; | ||
this.helpers = helpers; | ||
this.basePath = constants_1.DEFAULT_BASE_PATH; | ||
@@ -87,3 +86,3 @@ this.relaxedSecurityEnabled = false; | ||
this.commandsQueueGuard = new async_lock_1.default(); | ||
this.settings = new device_settings_1.default(); | ||
this.settings = new device_settings_1.DeviceSettings(); | ||
this.bidiEventSubs = {}; | ||
@@ -175,2 +174,3 @@ this.doesSupportBidi = false; | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
driverForSession(sessionId) { | ||
@@ -279,8 +279,11 @@ return this; | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
proxyActive(sessionId) { | ||
return false; | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
getProxyAvoidList(sessionId) { | ||
return []; | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
canProxy(sessionId) { | ||
@@ -302,2 +305,3 @@ return false; | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
proxyRouteIsAvoided(sessionId, method, url, body) { | ||
@@ -338,2 +342,12 @@ for (const avoidSchema of this.getProxyAvoidList(sessionId)) { | ||
} | ||
updateBidiCommands(cmds) { | ||
const overlappingKeys = lodash_1.default.intersection(Object.keys(cmds), Object.keys(this.bidiCommands)); | ||
if (overlappingKeys.length) { | ||
this.log.warn(`Overwriting existing bidi modules: ${JSON.stringify(overlappingKeys)}. This may not be intended!`); | ||
} | ||
this.bidiCommands = { | ||
...this.bidiCommands, | ||
...cmds, | ||
}; | ||
} | ||
async executeBidiCommand(bidiCmd, bidiParams) { | ||
@@ -347,7 +361,7 @@ const [moduleName, methodName] = bidiCmd.split('.'); | ||
} | ||
// if the command module isn't part of our spec, reject | ||
if (!bidi_commands_1.BIDI_COMMANDS[moduleName]) { | ||
// if the command module or method isn't part of our spec, reject | ||
if (!this.bidiCommands[moduleName] || !this.bidiCommands[moduleName][methodName]) { | ||
throw new protocol_1.errors.UnknownCommandError(); | ||
} | ||
const { command, params } = bidi_commands_1.BIDI_COMMANDS[moduleName][methodName]; | ||
const { command, params } = this.bidiCommands[moduleName][methodName]; | ||
// if the command method isn't part of our spec, also reject | ||
@@ -380,5 +394,7 @@ if (!command) { | ||
`method '${command}'`); | ||
const res = (await this[command](...args)) ?? null; | ||
this.log.debug(`Responding to bidi command '${bidiCmd}' with ${JSON.stringify(res)}`); | ||
return res; | ||
const response = await this[command](...args); | ||
const finalResponse = lodash_1.default.isUndefined(response) ? {} : response; | ||
this.log.debug(`Responding to bidi command '${bidiCmd}' with ` + | ||
`${lodash_1.default.truncate(JSON.stringify(finalResponse), { length: constants_1.MAX_LOG_BODY_LENGTH })}`); | ||
return finalResponse; | ||
} | ||
@@ -391,3 +407,3 @@ } | ||
*/ | ||
DriverCore.baseVersion = helpers_1.BASEDRIVER_VER; | ||
DriverCore.baseVersion = helpers.BASEDRIVER_VER; | ||
//# sourceMappingURL=core.js.map |
@@ -13,2 +13,24 @@ "use strict"; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || (function () { | ||
var ownKeys = function(o) { | ||
ownKeys = Object.getOwnPropertyNames || function (o) { | ||
var ar = []; | ||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
return ar; | ||
}; | ||
return ownKeys(o); | ||
}; | ||
return function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
})(); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
@@ -31,3 +53,3 @@ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
const core_1 = require("./core"); | ||
const helpers_1 = __importDefault(require("./helpers")); | ||
const helpers = __importStar(require("./helpers")); | ||
const EVENT_SESSION_INIT = 'newSessionRequested'; | ||
@@ -269,3 +291,3 @@ const EVENT_SESSION_START = 'newSessionStarted'; | ||
} | ||
this._log.prefix = helpers_1.default.generateDriverLogPrefix(this); | ||
this._log.prefix = helpers.generateDriverLogPrefix(this); | ||
this.log.updateAsyncContext({ | ||
@@ -272,0 +294,0 @@ sessionId: this.sessionId, |
@@ -371,4 +371,4 @@ "use strict"; | ||
} | ||
catch (ign) { | ||
logger_1.default.warn(`Failed to parse capability as JSON array`); | ||
catch (e) { | ||
logger_1.default.warn(`Failed to parse capability as JSON array: ${e.message}`); | ||
} | ||
@@ -388,2 +388,3 @@ if (lodash_1.default.isString(cap)) { | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
function generateDriverLogPrefix(obj, sessionId = null) { | ||
@@ -390,0 +391,0 @@ return `${obj.constructor.name}@${support_1.node.getObjectId(obj).substring(0, 4)}`; |
@@ -55,3 +55,3 @@ "use strict"; | ||
} | ||
catch (ign) { } | ||
catch { } | ||
} | ||
@@ -58,0 +58,0 @@ logger_1.default.info(requestStartLoggingFormat(tokens, req, res), reqBody.grey); |
@@ -49,3 +49,2 @@ "use strict"; | ||
logger_1.default.debug('Enabling TLS/SPDY on the server using the provided certificate'); | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
return require('spdy').createServer({ | ||
@@ -116,2 +115,3 @@ cert, | ||
app.use((0, serve_favicon_1.default)(path_1.default.resolve(static_1.STATIC_DIR, 'favicon.ico'))); | ||
// eslint-disable-next-line import/no-named-as-default-member | ||
app.use(express_1.default.static(static_1.STATIC_DIR)); | ||
@@ -118,0 +118,0 @@ // crash routes, for testing |
@@ -11,3 +11,2 @@ "use strict"; | ||
exports.getWebSocketHandlers = getWebSocketHandlers; | ||
/* eslint-disable require-await */ | ||
const lodash_1 = __importDefault(require("lodash")); | ||
@@ -52,3 +51,3 @@ const bluebird_1 = __importDefault(require("bluebird")); | ||
} | ||
catch (ign) { | ||
catch { | ||
// ignore | ||
@@ -55,0 +54,0 @@ } |
@@ -27,3 +27,3 @@ "use strict"; | ||
} | ||
catch (ign) { | ||
catch { | ||
// sometimes during testing this somehow gets required twice and results in an error about | ||
@@ -30,0 +30,0 @@ // cancellation not being able to be enabled after promise has been configured |
@@ -175,3 +175,3 @@ "use strict"; | ||
} | ||
catch (e) { | ||
catch { | ||
throw new Error(`Cannot interpret the request body as valid JSON: ${truncateBody(body)}`); | ||
@@ -178,0 +178,0 @@ } |
@@ -12,11 +12,17 @@ export namespace BIDI_COMMANDS { | ||
} | ||
namespace status { | ||
let command_2: "bidiStatus"; | ||
export { command_2 as command }; | ||
export let params: {}; | ||
} | ||
} | ||
namespace browsingContext { | ||
namespace navigate { | ||
let command_2: "bidiNavigate"; | ||
export { command_2 as command }; | ||
export namespace params { | ||
let command_3: "bidiNavigate"; | ||
export { command_3 as command }; | ||
export namespace params_1 { | ||
let required: readonly ["context", "url"]; | ||
let optional: readonly ["wait"]; | ||
} | ||
export { params_1 as params }; | ||
} | ||
@@ -23,0 +29,0 @@ } |
@@ -18,2 +18,6 @@ "use strict"; | ||
}, | ||
status: { | ||
command: 'bidiStatus', | ||
params: {}, | ||
} | ||
}, | ||
@@ -20,0 +24,0 @@ browsingContext: { |
@@ -13,11 +13,5 @@ export class ProtocolError extends BaseError { | ||
* @see https://w3c.github.io/webdriver-bidi/#protocol-definition | ||
* @returns The object conforming to the shape of a BiDi error response | ||
* @returns {import('@appium/types').ErrorBiDiCommandResponse} The object conforming to the shape of a BiDi error response | ||
*/ | ||
bidiErrObject(id: string | number): { | ||
id: string | number; | ||
type: string; | ||
error: any; | ||
stacktrace: any; | ||
message: string; | ||
}; | ||
bidiErrObject(id: string | number): import("@appium/types").ErrorBiDiCommandResponse; | ||
} | ||
@@ -24,0 +18,0 @@ export class NoSuchDriverError extends ProtocolError { |
@@ -68,12 +68,10 @@ "use strict"; | ||
* @see https://w3c.github.io/webdriver-bidi/#protocol-definition | ||
* @returns The object conforming to the shape of a BiDi error response | ||
* @returns {import('@appium/types').ErrorBiDiCommandResponse} The object conforming to the shape of a BiDi error response | ||
*/ | ||
bidiErrObject(id) { | ||
// if we don't have an id, the client didn't send one, so we have nothing to send back. | ||
// send back an empty string rather than making something up | ||
if (lodash_1.default.isNil(id)) { | ||
id = ''; | ||
} | ||
// send back zero rather than making something up | ||
const intId = /** @type {number} */ (lodash_1.default.isInteger(id) ? id : (parseInt(`${id}`, 10) || 0)); | ||
return { | ||
id, | ||
id: intId, | ||
type: 'error', | ||
@@ -80,0 +78,0 @@ error: this.error, |
@@ -1,4 +0,5 @@ | ||
import type {Constraints, Driver, IBidiCommands} from '@appium/types'; | ||
import type {Constraints, DriverStatus, IBidiCommands} from '@appium/types'; | ||
import type {BaseDriver} from '../driver'; | ||
import {mixin} from './mixin'; | ||
import _ from 'lodash'; | ||
@@ -35,4 +36,17 @@ declare module '../driver' { | ||
}, | ||
async bidiStatus<C extends Constraints>(this: BaseDriver<C>): Promise<DriverStatus> { | ||
const result = await this.getStatus(); | ||
if (!_.has(result, 'ready')) { | ||
//@ts-ignore This is OK | ||
result.ready = true; | ||
} | ||
if (!_.has(result, 'message')) { | ||
//@ts-ignore This is OK | ||
result.message = `${this.constructor.name} is ready to accept commands`; | ||
} | ||
return result as DriverStatus; | ||
} | ||
}; | ||
mixin(BidiCommands); |
@@ -8,3 +8,3 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ | ||
declare module '../driver' { | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
interface BaseDriver<C extends Constraints> extends IFindCommands {} | ||
@@ -11,0 +11,0 @@ } |
@@ -13,4 +13,3 @@ import {Constraints} from '@appium/types'; | ||
export function mixin<C extends Constraints, T extends Partial<BaseDriver<C>>>(mixin: T): void { | ||
// eslint-disable-next-line no-restricted-syntax | ||
Object.assign(BaseDriver.prototype, mixin); | ||
} |
@@ -79,2 +79,3 @@ import {waitForCondition} from 'asyncbox'; | ||
// pageLoad | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
async pageLoadTimeoutW3C<C extends Constraints>(this: BaseDriver<C>, ms) { | ||
@@ -84,2 +85,3 @@ throw new errors.NotImplementedError('Not implemented yet for pageLoad.'); | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
async pageLoadTimeoutMJSONWP<C extends Constraints>(this: BaseDriver<C>, ms) { | ||
@@ -90,2 +92,3 @@ throw new errors.NotImplementedError('Not implemented yet for pageLoad.'); | ||
// script | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
async scriptTimeoutW3C<C extends Constraints>(this: BaseDriver<C>, ms) { | ||
@@ -95,2 +98,3 @@ throw new errors.NotImplementedError('Not implemented yet for script.'); | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
async scriptTimeoutMJSONWP<C extends Constraints>(this: BaseDriver<C>, ms) { | ||
@@ -106,3 +110,3 @@ throw new errors.NotImplementedError('Not implemented yet for script.'); | ||
setImplicitWait<C extends Constraints>(this: BaseDriver<C>, ms: number) { | ||
// eslint-disable-line require-await | ||
this.implicitWaitMs = ms; | ||
@@ -109,0 +113,0 @@ this.log.debug(`Set implicit wait to ${ms}ms`); |
@@ -1,4 +0,1 @@ | ||
/* eslint-disable no-unused-vars */ | ||
/* eslint-disable require-await */ | ||
import {logger} from '@appium/support'; | ||
@@ -17,3 +14,4 @@ import type { | ||
StringRecord, | ||
BidiMethodDef, | ||
BidiModuleMap, | ||
BiDiResultData, | ||
} from '@appium/types'; | ||
@@ -30,4 +28,4 @@ import AsyncLock from 'async-lock'; | ||
import {errors} from '../protocol'; | ||
import DeviceSettings from './device-settings'; | ||
import helpers, {BASEDRIVER_VER} from './helpers'; | ||
import {DeviceSettings} from './device-settings'; | ||
import * as helpers from './helpers'; | ||
import {BIDI_COMMANDS} from '../protocol/bidi-commands'; | ||
@@ -49,3 +47,3 @@ | ||
*/ | ||
static baseVersion = BASEDRIVER_VER; | ||
static baseVersion = helpers.BASEDRIVER_VER; | ||
@@ -118,2 +116,4 @@ sessionId: string | null; | ||
bidiCommands: BidiModuleMap = BIDI_COMMANDS as BidiModuleMap; | ||
constructor(opts: InitialOpts = <InitialOpts>{}, shouldValidateCaps = true) { | ||
@@ -246,2 +246,3 @@ this._log = logger.getLogger(helpers.generateDriverLogPrefix(this as Core<C>)); | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
driverForSession(sessionId: string): Core<Constraints> | null { | ||
@@ -372,2 +373,3 @@ return this as Core<Constraints>; | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
proxyActive(sessionId: string): boolean { | ||
@@ -377,2 +379,3 @@ return false; | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
getProxyAvoidList(sessionId: string): RouteMatcher[] { | ||
@@ -382,2 +385,3 @@ return []; | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
canProxy(sessionId: string): boolean { | ||
@@ -400,2 +404,3 @@ return false; | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
proxyRouteIsAvoided(sessionId: string, method: HTTPMethod, url: string, body?: any): boolean { | ||
@@ -440,3 +445,14 @@ for (const avoidSchema of this.getProxyAvoidList(sessionId)) { | ||
async executeBidiCommand(bidiCmd: string, bidiParams: StringRecord): Promise<any> { | ||
updateBidiCommands(cmds: BidiModuleMap): void { | ||
const overlappingKeys = _.intersection(Object.keys(cmds), Object.keys(this.bidiCommands)); | ||
if (overlappingKeys.length) { | ||
this.log.warn(`Overwriting existing bidi modules: ${JSON.stringify(overlappingKeys)}. This may not be intended!`); | ||
} | ||
this.bidiCommands = { | ||
...this.bidiCommands, | ||
...cmds, | ||
}; | ||
} | ||
async executeBidiCommand(bidiCmd: string, bidiParams: StringRecord): Promise<BiDiResultData> { | ||
const [moduleName, methodName] = bidiCmd.split('.'); | ||
@@ -453,8 +469,9 @@ | ||
// if the command module isn't part of our spec, reject | ||
if (!BIDI_COMMANDS[moduleName]) { | ||
// if the command module or method isn't part of our spec, reject | ||
if (!this.bidiCommands[moduleName] || !this.bidiCommands[moduleName][methodName]) { | ||
throw new errors.UnknownCommandError(); | ||
} | ||
const {command, params} = BIDI_COMMANDS[moduleName][methodName] as BidiMethodDef; | ||
const {command, params} = this.bidiCommands[moduleName][methodName]; | ||
// if the command method isn't part of our spec, also reject | ||
@@ -493,6 +510,10 @@ if (!command) { | ||
); | ||
const res = (await this[command](...args)) ?? null; | ||
this.log.debug(`Responding to bidi command '${bidiCmd}' with ${JSON.stringify(res)}`); | ||
return res; | ||
const response = await this[command](...args); | ||
const finalResponse = _.isUndefined(response) ? {} : response; | ||
this.log.debug( | ||
`Responding to bidi command '${bidiCmd}' with ` + | ||
`${_.truncate(JSON.stringify(finalResponse), {length: MAX_LOG_BODY_LENGTH})}` | ||
); | ||
return finalResponse; | ||
} | ||
} |
@@ -27,3 +27,3 @@ import {util} from '@appium/support'; | ||
import {DriverCore} from './core'; | ||
import helpers from './helpers'; | ||
import * as helpers from './helpers'; | ||
@@ -30,0 +30,0 @@ const EVENT_SESSION_INIT = 'newSessionRequested'; |
@@ -392,4 +392,4 @@ import _ from 'lodash'; | ||
} | ||
} catch (ign) { | ||
logger.warn(`Failed to parse capability as JSON array`); | ||
} catch (e) { | ||
logger.warn(`Failed to parse capability as JSON array: ${e.message}`); | ||
} | ||
@@ -410,2 +410,3 @@ if (_.isString(cap)) { | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
export function generateDriverLogPrefix(obj, sessionId = null) { | ||
@@ -412,0 +413,0 @@ return `${obj.constructor.name}@${node.getObjectId(obj).substring(0, 4)}`; |
@@ -52,3 +52,3 @@ import _ from 'lodash'; | ||
}); | ||
} catch (ign) {} | ||
} catch {} | ||
} | ||
@@ -55,0 +55,0 @@ log.info(requestStartLoggingFormat(tokens, req, res), reqBody.grey); |
@@ -63,3 +63,3 @@ import _ from 'lodash'; | ||
log.debug('Enabling TLS/SPDY on the server using the provided certificate'); | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
return require('spdy').createServer({ | ||
@@ -155,2 +155,3 @@ cert, | ||
app.use(favicon(path.resolve(STATIC_DIR, 'favicon.ico'))); | ||
// eslint-disable-next-line import/no-named-as-default-member | ||
app.use(express.static(STATIC_DIR)); | ||
@@ -157,0 +158,0 @@ |
@@ -1,2 +0,2 @@ | ||
/* eslint-disable require-await */ | ||
import _ from 'lodash'; | ||
@@ -44,3 +44,3 @@ import B from 'bluebird'; | ||
return true; | ||
} catch (ign) { | ||
} catch { | ||
// ignore | ||
@@ -47,0 +47,0 @@ } finally { |
@@ -7,3 +7,3 @@ import B from 'bluebird'; | ||
}); | ||
} catch (ign) { | ||
} catch { | ||
// sometimes during testing this somehow gets required twice and results in an error about | ||
@@ -10,0 +10,0 @@ // cancellation not being able to be enabled after promise has been configured |
@@ -210,3 +210,3 @@ import _ from 'lodash'; | ||
reqOpts.data = JSON.parse(body); | ||
} catch (e) { | ||
} catch { | ||
throw new Error(`Cannot interpret the request body as valid JSON: ${truncateBody(body)}`); | ||
@@ -213,0 +213,0 @@ } |
@@ -16,2 +16,6 @@ const SUBSCRIPTION_REQUEST_PARAMS = /** @type {const} */ ({ | ||
}, | ||
status: { | ||
command: 'bidiStatus', | ||
params: {}, | ||
} | ||
}, | ||
@@ -18,0 +22,0 @@ browsingContext: { |
@@ -63,12 +63,10 @@ import _ from 'lodash'; | ||
* @see https://w3c.github.io/webdriver-bidi/#protocol-definition | ||
* @returns The object conforming to the shape of a BiDi error response | ||
* @returns {import('@appium/types').ErrorBiDiCommandResponse} The object conforming to the shape of a BiDi error response | ||
*/ | ||
bidiErrObject(id) { | ||
// if we don't have an id, the client didn't send one, so we have nothing to send back. | ||
// send back an empty string rather than making something up | ||
if (_.isNil(id)) { | ||
id = ''; | ||
} | ||
// send back zero rather than making something up | ||
const intId = /** @type {number} */ (_.isInteger(id) ? id : (parseInt(`${id}`, 10) || 0)); | ||
return { | ||
id, | ||
id: intId, | ||
type: 'error', | ||
@@ -75,0 +73,0 @@ error: this.error, |
{ | ||
"name": "@appium/base-driver", | ||
"version": "9.13.1", | ||
"version": "9.14.0", | ||
"description": "Base driver class for Appium drivers", | ||
@@ -47,4 +47,4 @@ "keywords": [ | ||
"dependencies": { | ||
"@appium/support": "^6.0.0", | ||
"@appium/types": "^0.22.3", | ||
"@appium/support": "^6.0.1", | ||
"@appium/types": "^0.23.0", | ||
"@colors/colors": "1.6.0", | ||
@@ -62,3 +62,3 @@ "@types/async-lock": "1.4.2", | ||
"body-parser": "1.20.3", | ||
"express": "4.21.1", | ||
"express": "4.21.2", | ||
"http-status-codes": "2.3.0", | ||
@@ -72,3 +72,3 @@ "lodash": "4.17.21", | ||
"source-map-support": "0.5.21", | ||
"type-fest": "4.30.0", | ||
"type-fest": "4.31.0", | ||
"validate.js": "0.13.1" | ||
@@ -86,3 +86,3 @@ }, | ||
}, | ||
"gitHead": "1d16ac6b4521b1ac06b8650c6bb5c311d8d49ae3", | ||
"gitHead": "8480a85ce2fa466360e0fb1a7f66628331907f02", | ||
"tsd": { | ||
@@ -89,0 +89,0 @@ "directory": "test/types" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
16854
953620
212
+ Added@appium/types@0.23.0(transitive)
+ Addedexpress@4.21.2(transitive)
+ Addedpath-to-regexp@0.1.12(transitive)
- Removed@appium/types@0.22.3(transitive)
- Removedexpress@4.21.1(transitive)
- Removedpath-to-regexp@0.1.10(transitive)
- Removedtype-fest@4.30.0(transitive)
Updated@appium/support@^6.0.1
Updated@appium/types@^0.23.0
Updatedexpress@4.21.2
Updatedtype-fest@4.31.0