Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private prettyIndexString(index: API.Index): string {
let result = "";
if (index.state) {
const stateMsg = `[${index.state}] `;
if (index.state === API.State.READY) {
result += clc.green(stateMsg);
} else if (index.state === API.State.CREATING) {
result += clc.yellow(stateMsg);
} else {
result += clc.red(stateMsg);
}
}
const nameInfo = util.parseIndexName(index.name);
result += clc.cyan(`(${nameInfo.collectionGroupId})`);
result += " -- ";
index.fields.forEach((field) => {
if (field.fieldPath === "__name__") {
return;
}
// Normal field indexes have an "order" while array indexes have an "arrayConfig",
if (line[line.length - 1] !== '\n') {
line += '\n';
}
if (i == 2) {
msg += ` ${clc.xterm(245)('|')} ${clc.xterm(250)(line)}`;
} else {
msg += ` ${clc.xterm(235)('|')} ${clc.xterm(240)(line)}`;
}
}
console.log(msg);
}
console.log(clc.red(`${counts['error'] || 0} Error${counts['error'] === 1 ? '' : 's'}`) + ' ' + clc.yellow(`${counts['warn'] || 0} Warning${counts['warn'] === 1 ? '' : 's'}`) + ' ' + clc.xterm(32)(`${counts['info'] || 0} Info`));
process.exit(counts['error'] + counts['warn'] > 0 ? 1 : 0);
});
});
function loadDynamoEndpoint(env, dynamoConfig) {
if (typeof env.DYNAMO_ENDPOINT === 'string') {
if (env.DYNAMO_ENDPOINT.indexOf('.amazonaws.com') > -1) {
console.error(
clc.red('dynamodb-admin is only intended for local development')
)
process.exit(1)
}
dynamoConfig.endpoint = env.DYNAMO_ENDPOINT
dynamoConfig.sslEnabled = env.DYNAMO_ENDPOINT.indexOf('https://') === 0
} else {
console.log(
clc.yellow(
' DYNAMO_ENDPOINT is not defined (using default of http://localhost:8000)'
)
)
}
}
const displayTrialName = (trial) => {
if (trial.description) return console.log(clc.magenta(`--- ${trial.description} ---`));
const name = `${trial.type} ${trial.table} (${trial.columns.join(', ')})`;
const pragma = trial.customPragma.length ? ` | ${trial.customPragma.join('; ')}` : '';
console.log(clc.magenta(name) + clc.yellow(pragma));
};
async function lookupGuid (obj, ms) {
await sleep(ms);
const data = await rp(obj);
if (count < 10) {
if(JSON.parse(data).result == 'Pending in queue'){
if (cli == true) {
console.log(clc.yellow('Pending in queue...'));
console.log(clc.yellow('Please wait...'));
}
count++;
return await lookupGuid(obj, ms);
} else {
return JSON.parse(data);
}
} else {
throw new Error('Contract Verification Timeout!!! Check Final Status on Etherscan');
}
}
return await lookupGuid(obj, ms);
#!/usr/bin/env node
const async = require('async');
const clc = require('cli-color');
const _ = require('lodash');
const save = require('../index');
const parseUrlsFromFile = require('../lib/parse-urls-from-file');
const dir = process.cwd();
const params = process.argv.slice(2);
if (params.length < 1) {
return console.log(clc.yellow(`Usage: `) + clc.white(`instagram-save [URL or MEDIA_ID]`));
}
if (params[0] === '-f') {
const sourceFile = params[1];
if (!sourceFile) {
return console.log(clc.red(`You must specify a source file.`));
}
parseUrlsFromFile(sourceFile).then(urls => {
async.map(urls, saveAndLog);
}, err => {
console.log(clc.red(err.message));
});
} else {
async.map(params, saveAndLog);
function format(type, statement) {
if (type === 'group' || type === 'groupCollapsed') {
if ((/warning/i).test(statement)) {
konsole.group(clc.yellow(statement));
} else if ((/error/i).test(statement)) {
konsole.group(clc.red(statement));
} else {
konsole.group(statement);
}
return;
}
if (type === 'groupEnd') {
konsole.groupEnd();
return;
}
var message, source, line, column, id;
message = statement.message;
private prettyFieldString(field: API.Field): string {
let result = "";
const parsedName = util.parseFieldName(field.name);
result +=
"[" +
clc.cyan(parsedName.collectionGroupId) +
"." +
clc.yellow(parsedName.fieldPath) +
"] --";
const fieldIndexes = field.indexConfig.indexes || [];
if (fieldIndexes.length > 0) {
fieldIndexes.forEach((index) => {
const firstField = index.fields[0];
const mode = firstField.order || firstField.arrayConfig;
result += ` (${mode})`;
});
} else {
result += " (no indexes)";
}
return result;
}
}
var toPrettyString = function(index) {
var result = "";
if (index.state) {
var stateMsg = "[" + index.state + "] ";
if (index.state === "READY") {
result += clc.green(stateMsg);
} else if (index.state === "CREATING") {
result += clc.yellow(stateMsg);
} else {
result += clc.red(stateMsg);
}
}
result += clc.cyan("(" + index.collectionId + ")");
result += " -- ";
index.fields.forEach(function(field) {
if (field.fieldPath === "__name__") {
return;
}
result += "(" + field.fieldPath + "," + field.mode + ") ";
});
function performanceDisplayInfo(time: Date, info: string): string {
return colors.yellow('[perf][' + time + '] ' + info);
}