Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async signin (user, opts = { }) {
let browser
try {
browser = opts.browser || await puppeteer.launch(opts.puppeteer)
ow(user, ow.object.plain.nonEmpty.label('user'))
ow(user.password, ow.string.nonEmpty.label('user.password'))
if (user.username) {
ow(user.username, ow.string.nonEmpty.label('user.username'))
user.email = `${user.username}@${this._provider.name}.com`
ow(user.email, ow.string.nonEmpty.label('user.email'))
} else if (user.email) {
ow(user.email, ow.string.nonEmpty.label('user.email'))
user.username = user.email.split('@')[0].trim()
ow(user.username, ow.string.nonEmpty.label('user.username'))
} else {
throw new Error('missing required parameter "username" or "email"')
}
const session = await this._provider.signin(user, {
browser,
: output
const frameType = (isJpg ? 'jpeg' : 'png')
const isMultiFrame = isMp4 || /%d|%\d{2,3}d/.test(tempOutput)
let lottieData = animationData
if (animationPath) {
if (animationData) {
throw new Error('"animationData" and "path" are mutually exclusive')
}
ow(animationPath, ow.string.nonEmpty, 'path')
lottieData = fs.readJsonSync(animationPath)
} else if (animationData) {
ow(animationData, ow.object.plain.nonEmpty, 'animationData')
} else {
throw new Error('Must pass either "animationData" or "path"')
}
const fps = ~~lottieData.fr
const { w = 640, h = 480 } = lottieData
const aR = w / h
ow(fps, ow.number.integer.positive, 'animationData.fr')
ow(w, ow.number.integer.positive, 'animationData.w')
ow(h, ow.number.integer.positive, 'animationData.h')
if (!(width && height)) {
if (width) {
height = width / aR
} else if (height) {
addTasks(tasks) {
ow(tasks, ow.any(ow.array, ow.object));
this._addOrRemoveTasks(tasks, this.addTask, 'add');
return this;
}
constructor (opts = { }) {
super()
ow(opts, ow.object.plain.label('opts'))
const authId = opts.authId || process.env.PLIVO_AUTH_ID
const authToken = opts.authToken || process.env.PLIVO_AUTH_TOKEN
ow(authId, ow.string.nonEmpty.label('plivo authId'))
ow(authToken, ow.string.nonEmpty.label('plivo authToken'))
this._messages = { }
this._client = new plivo.Client(authId, authToken)
this._server = new IncomingSMSServer({
transform: (body) => {
const message = {
from: body.From,
to: body.To,
constructor (provider, opts = { }) {
this._provider = typeof provider === 'object'
? provider
: providers.getProviderByName(provider, opts)
ow(this._provider, ow.object.instanceOf(CaptchaSolverProvider))
ow(opts, ow.object.plain)
}
getUrlForPage(page) {
ow(page, ow.object.hasKeys('_target._targetInfo.targetId'))
const pageId = page._target._targetInfo.targetId
return super.getUrlForPageId(pageId)
}
private static async loadFromFilesBasedOnPriority(
command: commander.Command, prevConfig: Config,
): Promise {
ow(command, ow.object.label("command"));
ow(prevConfig, ow.object.label("prevConfig"));
const configFiles: string [] = _.cloneDeep(StaticConfig.DEFAULT_CONFIG_FILE_PATHS);
if (command.configFile) configFiles.unshift(command.configFile);
const newConfig = await PrioritizedFileObjectLoader.loadFromFiles(prevConfig, configFiles, "config");
const configLoadedFromFile: ConfigLoadedFromFile = {
...newConfig.loadedObject,
configFilePath: path.resolve((newConfig.path ? newConfig.path : ".")),
};
return configLoadedFromFile;
}
constructor(opts) {
ow(opts, ow.object.hasKeys('obj'))
ow(opts.obj, ow.object.hasKeys('constructor'))
this._obj = opts.obj
this._meta = {
type: typeof this._obj,
name: this._obj.constructor.name,
members:
Object.getOwnPropertyNames(Object.getPrototypeOf(this._obj)) || []
}
this._completions = [].concat(this.extraMethods, this._meta.members)
}