Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const qs = require("querystring");
const md5 = require("md5");
const youdao_zh_2_en = "zh-CHS2EN";
process.env.NODE_ENV = "production";
// process.env.NODE_ENV = "dev";
let isDev = require("isdev");
const Preview = require("./Preview.jsx").default;
console.log("isDev:", isDev);
if (isDev) {
log.setLevel("debug");
log.debug("in Development");
} else {
log.setLevel("silent");
console.log("Not in Development!");
}
var getKeyWordReg = function(key) {
return new RegExp(
"([\\-_\\w\\d\\/\\$]{0,}){0,1}" + key + "([\\-_\\w\\d\\$]{0,}){0,1}",
"gi"
);
};
var showing_display = [];
const youdaoapi_url = "http://openapi.youdao.com/api";
var searchcode_axios = axios.create({
// TODO: label template storage
// TODO: command chaining
// TODO: command wiring to label object
// TODO: label may also contain width/height (for continuous media)
program
.version('0.0.1')
.option('-c, --content <content>', 'label content as JSON')
.option('-j, --json ', 'JSON description of printing parameters')
.option('-v, --verbose', 'ouput useful information', (v, total) => (total === 0) ? 0 : total-1, 2)
.option('-t, --test', 'print a test label')
.option('-c, --check', 'dry-run; do not send label to printer')
.parse(process.argv);
console.log('loglevel: '+program.verbose);
log.setLevel(program.verbose);
var defaultPrinterModel = PRINTERS.ZEBRA_GX430T;
var defaultPrinter = Object.assign({
name: 'Default Printer',
address: '192.168.1.14'
}, defaultPrinterModel, program.json && program.json.printer);
var defaultMedia = {
width: 2 * 25.4,
length: 1 * 25.4,
// [thermal type]
// [thickness?]
// [price/label?]
// [spool size]
// [supply quantity]
// [model / reorder number?]
};</content>
)
parser.addArgument(
['--prune-months'], {
help: 'The amount of history (in number of months) to retain in Redshift',
type: 'int'
}
)
var args = parser.parseArgs()
if (args.debug) {
log.setLevel('debug')
log.debug('Debugging output enabled.')
} else {
log.setLevel('info')
}
log.debug(`Resolved invocation arguments were:\n${util.inspect(args)}`)
if (args.specific !== null && args.prune_months !== null) {
log.error('The "--specific" and "--prune-months" options are mutually exclusive.')
log.error('--prune-months can only be invoked when importing the latest DBR.')
log.error('Aborting.')
process.exit(1)
}
// Instantiate a DBR object to work with.
var dbrClientOptions = {
accessKeyId: args.source_key,
secretAccessKey: args.source_secret
}
import React, { Component } from 'react'
import Spinner from '../Spinner/Spinner';
import { pollThings } from '../../util/DataPoller'
// import { buildKpiInfo } from '../../util/KPIConfigInterpreter'
import log from 'loglevel'
log.setLevel(process.env.REACT_APP_LOG_LEVEL || 'debug')
const DEVICE_REFRESH_MS = process.env.REACT_APP_DEVICE_REFRESH_MS || 5000
function pollDevices () {
pollThings()
.then(things => {
this.setState({
things
})
})
.catch(err => `Could not poll devices... ${err}`)
}
export class KpiCardSingleValue extends Component {
state = {
loading: true,
things: []
async function main () {
try {
const nodeEnv = process.env.NODE_ENV
log.setLevel('info')
chromeEventLog.setLevel('info')
if (nodeEnv === 'development') {
// more detail, generally:
log.setLevel('debug')
// Enable to see every Chrome event:
// chromeEventLog.setLevel('debug')
}
log.info('bgHelper started, env: ', nodeEnv)
actions.setReloadHandler(main)
const rawBMStore = await initWinStore()
const attachBMStore = await reattachWindows(rawBMStore)
const bmStore = await loadSnapState(attachBMStore)
const storeRef = new ViewRef(bmStore)
window.storeRef = storeRef
await actions.loadPreferences(storeRef)
await actions.syncChromeWindows(storeRef)
log.log('initial sync of chrome windows complete.')
var log = require("loglevel");
log.setLevel("debug");
var prefix = require('loglevel-plugin-prefix');
var chalk = require('chalk');
var fs = require('fs');
var util = require('util');
var moment = require('moment');
// #### logging decoration ####
// see https://github.com/kutuluk/loglevel-plugin-prefix
const colors = {
TRACE: chalk.magenta,
DEBUG: chalk.cyan,
INFO: chalk.blue,
WARN: chalk.yellow,
ERROR: chalk.red,
};
'use strict'
import logger from 'loglevel'
const log = console.log.bind(null, '[Blyde]')
const trace = logger.trace.bind(null, '[Blyde]')
const debug = logger.debug.bind(null, '[Blyde]')
const info = logger.info.bind(null, '[Blyde]')
const warn = logger.warn.bind(null, '[Blyde]')
const error = logger.error.bind(null, '[Blyde]')
if (ENV === 'production' && !localStorage.bdFlag) {
logger.setLevel('error')
} else {
logger.setLevel('trace')
}
info('Debug logging enabled!')
export { log, trace, debug, info, warn, error, logger }
import React, {Component} from 'react'
import {Map, Marker, Popup, TileLayer} from 'react-leaflet'
import log from 'loglevel'
import DeviceTooltip from '../DeviceTooltip/DeviceTooltip'
import {store} from '../../store'
import {getThingsInTopology, getTextAfterColon} from '../../util'
import {CATEGORIES} from "../../util/cardUtils"
log.setLevel(process.env.REACT_APP_LOG_LEVEL || 'debug')
class OSMap extends Component {
state = {
selectedStates: []
}
isInTopology(thingId, thingsInTopology) {
let isIn = false
thingsInTopology.forEach(thingIdInTopology => {
if (thingId.includes(thingIdInTopology)) {
isIn = true
}
})
return isIn
}
import React, {Component} from 'react'
import TreeView from 'react-treeview'
import log from 'loglevel'
import Spinner from '../Spinner/Spinner';
import {getTextAfterColon} from '../../util'
import Actions from '../../actions/'
import {connect} from 'react-redux';
import {withRouter} from 'react-router';
log.setLevel(process.env.REACT_APP_LOG_LEVEL || 'debug')
const {store} = require('../../store')
const LabelType = {
DEVICE: "DEVICE",
LABEL: "LABEL",
ROOT: "ROOT"
}
const FALLBACK_ROOT = {
thingId: ":My Devices",
attributes: {
topology: {
definition: "org.eclipse.vorto:Topology:1.0.0"
},
thingName: "My Devices",
}
import clean from "./clean";
import { DEBUG, SILENT } from "./constants";
import docConstants from "./docConstants";
import prepublish from "./prepublish";
import readmes from "./readmes";
import sandbox from "./sandbox";
import sassdoc from "./sassdoc";
import createScssVariables from "./scssVariables";
import copyStyles from "./utils/copyStyles";
import createThemes from "./utils/createThemes";
import watch from "./watch";
const argv = process.argv.slice(2);
if (argv.includes(DEBUG)) {
loglevel.setLevel("debug");
} else if (argv.includes(SILENT)) {
loglevel.setLevel("error");
} else {
loglevel.setLevel("info");
}
const createCommand = (command: string): commander.Command =>
commander
.command(command)
.option(DEBUG, "Enables the verbose logging to help debug errors.")
.option(SILENT, "Disables all logging.");
createCommand("build")
.description(
"Compiles all the typescript files in each package that contains components or scssVariables. " +
"When run from the root, all packages will be built in dependency order with lerna."