Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const grpc = require('grpc');
const proto = require('./load');
const {getDefaultArgs} = require('appium/build/lib/parser');
const {AppiumDriver} = require('appium/build/lib/appium');
const log = require('appium/build/lib/logger').default;
const driver = new AppiumDriver(getDefaultArgs());
async function runCommand (call, cb) {
let {cmdName, sessionId, urlParams, jsonParams} = call.request;
try {
jsonParams = JSON.parse(jsonParams.toString('utf-8'));
} catch (e) {
return cb(e);
}
if (sessionId) {
urlParams = [sessionId, ...urlParams];
}
urlParams.reverse();
let res;
try {
let jsonParamArgs = Object.keys(jsonParams).map(k => jsonParams[k]);