Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | 4x 4x 4x 4x 8x 36x 8x 260x 276x 276x 56x 276x 276x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x | import changeCase from 'change-case'
const protocols = [
require('../apis/sauce.json'),
require('../apis/rdc.json')
]
const protocolFlattened = new Map()
const parametersFlattened = new Map()
for (const { paths, parameters, host, basePath } of protocols) {
for (const [name, description] of Object.entries(parameters || {})) {
parametersFlattened.set(name, description)
}
for (const [endpoint, methods] of Object.entries(paths)) {
for (const [method, description] of Object.entries(methods)) {
let commandName = changeCase.camelCase(description.operationId)
/**
* mark commands as depcrecated in the command names
*/
if (description.deprecated) {
commandName += 'Deprecated'
}
/**
* ensure we don't double registet commands
*/
Iif (protocolFlattened.has(commandName)) {
throw new Error(`command ${commandName} already registered`)
}
protocolFlattened.set(
commandName,
{ method, endpoint, description, host, basePath }
)
}
}
}
export const PROTOCOL_MAP = protocolFlattened
export const PARAMETERS_MAP = parametersFlattened
export const JOB_ASSET_NAMES = [
'console.json',
'performance.json',
'automator.log',
'selenium-server.log',
'log.json',
'logcat.log',
'video.mp4'
]
export const DEFAULT_OPTIONS = {
user: process.env.SAUCE_USERNAME,
key: process.env.SAUCE_ACCESS_KEY,
headless: false,
region: 'us'
}
export const REGION_MAPPING = {
'us': '', // default endpoint
'eu': 'eu-central-1.'
}
export const SYMBOL_INSPECT = Symbol.for('nodejs.util.inspect.custom')
export const SYMBOL_TOSTRING = Symbol.toStringTag
export const SYMBOL_ITERATOR = Symbol.iterator
export const TO_STRING_TAG = 'SauceLabs API Client'
export const USAGE = `Sauce Labs API CLI
Usage: sl <command> [options]`
export const EPILOG = `Copyright ${(new Date()).getUTCFullYear()} © Sauce Labs`
export const CLI_PARAMS = [{
alias: 'h',
name: 'help',
description: 'prints help menu'
}, {
alias: 'u',
name: 'user',
description: 'your Sauce Labs username'
}, {
alias: 'k',
name: 'key',
description: 'your Sauce Labs user key'
}, {
alias: 'r',
name: 'region',
default: DEFAULT_OPTIONS.region,
description: 'your Sauce Labs datacenter region, the following regions are available: `us-west-1` (short `us`), `eu-central-1` (short `eu`)'
}, {
alias: 'h',
name: 'headless',
default: DEFAULT_OPTIONS.headless,
description: 'if set to true you are accessing the headless Sauce instances (this discards the `region` option)'
}]
|