Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
process.exit(1);
}
return result;
}, {});
await copyFiles(types, "types", {
message:
"Copying over the type definitions for the sassdoc package and the custom formatted sassdocs.",
replace: name =>
name
.replace("types", "formattedSassDoc")
.substring(name.indexOf("sassdoc/") + "sassdoc/".length),
});
log.info("Generating SassDoc files...");
await Promise.all(
Object.entries(combined).map(([name, formatted]) => {
const fileName = `${toTitle(name)}SassDoc`;
const filePath = path.join(
documentationRoot,
"constants",
`${fileName}.ts`
);
const contents = format(`/* this is a generated file and shouldn't be manually updated */
import { PackageSassDoc } from "types/formattedSassDoc.d";
const ${fileName}: PackageSassDoc = ${JSON.stringify(formatted)};
export default ${fileName};
`);
sendAsync(payload, cb) {
log.info('ASYNC REQUEST', payload)
const self = this
// fixes bug with web3 1.0 where send was being routed to sendAsync
// with an empty callback
if (cb === undefined) {
self.rpcEngine.handle(payload, noop)
return self._sendSync(payload)
} else {
self.rpcEngine.handle(payload, cb)
}
}
websocketStatusCallback(message) {
switch (message) {
case 'open': {
log.info('Websocket connection is open.');
if (ConnectionUtils.isConnectedToInternet()) {
// Internet is on and websocket is open
// Setup the health check.
CommunicationService.ping();
this.connectionStatusCallback(ConnectionStatus.CONNECTED);
} else {
// Internet is off and websocket is closed
this.connectionStatusCallback(ConnectionStatus.DISCONNECTED);
this.closeConnectionToBlockchain();
}
break;
}
function initAbletonLinkServer(bpm: number=120, quantum: number=4,
enable: boolean=false): boolean {
link = new abletonlink(bpm, quantum, enable);
WindowManager.send(link_channel_prefix + 'initialized-status',
true);
setLinkEnabled(enable);
// TODO(theis): how to detect errors in initialization?
log.info(link)
let success = true
link.on('tempo', (bpm) => {
log.info('LINK: BPM changed, now ' + bpm)
WindowManager.send(link_channel_prefix + 'tempo', bpm);
}
);
link.on('numPeers', (numPeers) => {
log.info('LINK: numPeers changed, now ' + numPeers);
WindowManager.send(link_channel_prefix + 'numPeers', numPeers);
}
);
return success
};
updater.checkNewVersion(function (err, newVersionExists, newManifest) {
if (err) {
log.error('request for app update manifest failed', err);
return tryAgainLater();
}
if (!newVersionExists) {
log.info('app currently at latest version');
return tryAgainLater();
}
// Update available!
var version = newManifest.version;
log.info('app update ' + version + ' available');
if (os === 'linux') {
// linux cannot autoupdate (yet)
return notifyUpdateFallback(version);
}
getUpdate(newManifest, function(err, newAppDir) {
if (err) {
log.error('app update ' + version + ' failed to download and unpack', err.message);
return tryAgainLater();
}
var executable = newManifest.name + (os === 'win' ? '.exe' : '.app');
var newAppExecutable = path.join(newAppDir, executable);
return notifyWinOsxUser(version, newAppExecutable);
ID: 'provider_id:device_id'
Key: trip_id
Field Hash keys include:
timestamp
latitude
longitude
annotation_version
annotation
*/
let trip_id
// Check if accosiated to an event or telemetry post
if (device_state.type === 'telemetry') {
let trips = await hget('trip:state', device_state.provider_id + ':' + device_state.device_id)
// Requires trip start event to match telemetry to tripID
if (!trips) {
log.info('NO TRIP DATA FOUND')
return null
} else {
trips = JSON.parse(trips)
let trip
let trip_start_time
// find latest trip whose start time is before current timestamp
for (let trip_key in trips) {
trip = trips[trip_key]
for (let i in trip) {
if (trip[i].event === 'trip_start') {
if (
trip[i].timestamp <= device_state.timestamp &&
(!trip_start_time || trip_start_time <= trip[i].timestamp)
) {
trip_id = trip_key
trip_start_time = trip[i].timestamp
if (guitarPro) {
noteOctave += 1;
}
}
} else if (noteElement.name === "instrument") {
if (noteElement.firstAttribute !== undefined) {
playbackInstrumentId = noteElement.firstAttribute.value;
}
} else if (noteElement.name === "notehead") {
noteheadShapeXml = noteElement.value;
if (noteElement.attribute("filled") !== null) {
noteheadFilledXml = noteElement.attribute("filled").value === "yes";
}
}
} catch (ex) {
log.info("VoiceGenerator.addSingleNote: ", ex);
}
}
noteOctave -= Pitch.OctaveXmlDifference;
const pitch: Pitch = new Pitch(noteStep, noteOctave, noteAccidental);
const noteLength: Fraction = Fraction.createFromFraction(noteDuration);
const note: Note = new Note(this.currentVoiceEntry, this.currentStaffEntry, noteLength, pitch);
note.TypeLength = typeDuration;
note.NoteTypeXml = noteTypeXml;
note.NormalNotes = normalNotes;
note.PrintObject = printObject;
note.IsCueNote = isCueNote;
note.StemDirectionXml = stemDirectionXml; // maybe unnecessary, also in VoiceEntry
note.TremoloStrokes = tremoloStrokes; // could be a Tremolo object in future if we have more data to manage like two-note tremolo
if ((noteheadShapeXml !== undefined && noteheadShapeXml !== "normal") || noteheadFilledXml !== undefined) {
note.Notehead = new Notehead(note, noteheadShapeXml, noteheadFilledXml);
export async function createSandboxesLookup(): Promise {
log.info("Generating the main sandbox lookup file...");
const sandboxes = await findGeneratedSandboxes();
log.debug("Found the following sandboxes to add:");
log.debug(list(sandboxes));
log.debug();
const packages = new Set();
const lookups = sandboxes.reduce((lookups, pathname) => {
const [pkg, fileName] = pathname
.substring(pathname.lastIndexOf("/") + 1)
.split("-");
packages.add(`"${pkg}"`);
lookups[pkg] = lookups[pkg] || {};
lookups[pkg][
fileName.replace(".json", "")
] = `() => resolve(import('./${pkg}-${fileName}'))`;
.then(name => log.info(`Added Extension: ${name}`))
.catch(err => log.info('An error occurred: ', err));
events.on('app:quit', function() {
log.info('App is quiting, cleanup avatars');
try {
rimraf.sync(tempAvatarDirectory);
}
catch(err) {
log.error('Something went wrong while cleaning up the avatars: ' + err.message + err.stack);
}
});