Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import createDebugLogger from "debug"
import EventEmitter from "events"
import format from "pg-format"
import TypedEventEmitter from "typed-emitter"
// Need to require `pg` like this to avoid ugly error message (see #15)
import pg = require("pg")
const connectionLogger = createDebugLogger("pg-listen:connection")
const notificationLogger = createDebugLogger("pg-listen:notification")
const paranoidLogger = createDebugLogger("pg-listen:paranoid")
const subscriptionLogger = createDebugLogger("pg-listen:subscription")
const delay = (ms: number) => new Promise(resolve => setTimeout(resolve, ms))
interface PgNotification {
processId: number,
channel: string,
payload?: string
}
export interface PgParsedNotification {
processId: number,
channel: string,
payload?: any
import Bluebird from 'bluebird'
import debugModule from 'debug'
import _ from 'lodash'
const chromeRemoteInterface = require('chrome-remote-interface')
const errors = require('../errors')
const debugVerbose = debugModule('cypress-verbose:server:browsers:cri-client')
// debug using cypress-verbose:server:browsers:cri-client:send:*
const debugVerboseSend = debugModule('cypress-verbose:server:browsers:cri-client:send:[-->]')
// debug using cypress-verbose:server:browsers:cri-client:recv:*
const debugVerboseReceive = debugModule('cypress-verbose:server:browsers:cri-client:recv:[<--]')
/**
* Url returned by the Chrome Remote Interface
*/
type websocketUrl = string
/**
* Enumerations to make programming CDP slightly simpler - provides
* IntelliSense whenever you use named types.
*/
namespace CRI {
export type Command =
import Debug from 'debug'
import { Worker as GenerateWorker, Commands } from '../generate'
import { Messaging } from './mixins'
const debug = Debug('nuxt:worker')
export default class Worker extends Messaging(GenerateWorker) {
constructor(options, cliOptions = {}, id) {
super(options)
this.setId(id)
this.hook(Commands.sendRoutes, this.generateRoutes.bind(this))
}
async init() {
await super.init()
this.generator.nuxt.hook('generate:routeCreated', ({ route, path }) => {
path = path.replace(this.generator.distPath, '')
debug(`Worker ${this.id} generated file: ${path}`)
async tryWithdraw(_secret) {
const { secret, secretHash, isEthWithdrawn, isBchWithdrawn } = this.state
if (!_secret)
throw new Error(`Withdrawal is automatic. For manual withdrawal, provide a secret`)
if (secret && secret != _secret)
console.warn(`Secret already known and is different. Are you sure?`)
if (isEthWithdrawn)
console.warn(`Looks like money were already withdrawn, are you sure?`)
debug('swap.core:flow')(`WITHDRAW using secret = ${_secret}`)
const _secretHash = crypto.ripemd160(Buffer.from(_secret, 'hex')).toString('hex')
if (secretHash != _secretHash)
console.warn(`Hash does not match! state: ${secretHash}, given: ${_secretHash}`)
const { participant } = this.swap
const data = {
ownerAddress: participant.eth.address,
secret: _secret,
}
await this.ethSwap.withdraw(data, (hash) => {
debug('swap.core:flow')(`TX hash=${hash}`)
this.setState({
import debug from 'debug'
import page from 'page'
import dom from 'component-dom'
import t from 't-component'
import urlBuilder from 'lib/url-builder'
import title from '../../title/title'
import user from '../../user/user'
import ForumForm from './forum-form/forum-form'
const log = debug('democracyos:forum')
page(urlBuilder.for('forums.new'), user.required, canCreateForum, () => {
log('render forums.new')
title(t('forum.new.title'))
document.body.classList.add('forum-new')
let section = dom('section#content.site-content').empty()
let view = new ForumForm()
view.appendTo(section[0])
})
page.exit(urlBuilder.for('forums.new'), (ctx, next) => {
document.body.classList.remove('forum-new')
next()
import Funnel from 'broccoli-funnel';
import createDebug from 'debug';
import noop from 'lodash/noop';
import after from 'lodash/after';
import dropWhile from 'lodash/dropWhile';
import takeWhile from 'lodash/takeWhile';
import semver from 'semver';
import ui from './ui';
import Builder from './builder';
import Watcher from './watcher';
import tryRequire from '../utils/try-require';
import startTimer from '../utils/timer';
import spinner from '../utils/spinner';
import DenaliObject from '../metal/object';
const debug = createDebug('denali:project');
export default class Project extends DenaliObject {
builders = new Map();
constructor(options = {}) {
this.dir = options.dir || process.cwd();
debug(`creating project for ${ this.dir }`);
this.environment = options.environment || 'development';
this.printSlowTrees = options.printSlowTrees || false;
this.pkg = require(path.join(this.dir, 'package.json'));
this.lint = options.lint;
this.audit = options.audit;
this.buildDummy = options.buildDummy;
this.pkg = require(path.join(this.dir, 'package.json'));
}
/***
* Copyright (c) 2016 - 2019 Alex Grant (@localnerve), LocalNerve LLC
* Copyrights licensed under the BSD License. See the accompanying LICENSE file for terms.
*/
import debugLib from 'debug';
import syncable from 'utils/syncable';
const debug = debugLib('actions:contact');
/**
* Perform the contact service request.
*
* @param {Object} context - The fluxible action context.
* @param {Object} fields - The contact fields.
* @param {String} fields.email - The contact replyTo email address.
* @param {Function} done - The callback to execute on completion.
*/
function serviceRequest (context, fields, done) {
context.service.create(
'contact',
syncable.contact(fields, fields.email), {}, {}, (err) => {
if (err) {
debug('dispatching CREATE_CONTACT_FAILURE');
context.dispatch('CREATE_CONTACT_FAILURE', fields);
this.finishStep({
isBchWithdrawn: true,
}, { step: 'withdraw-bch' })
throw new Error(`Already withdrawn: address=${scriptAddress},balance=${balance}`)
}
await this.bchSwap.withdraw({
scriptValues: bchScriptValues,
secret: _secret,
}, (hash) => {
debug('swap.core:flow')(`TX hash=${hash}`)
this.setState({
bchSwapWithdrawTransactionHash: hash,
})
})
debug('swap.core:flow')(`TX withdraw sent: ${this.state.bchSwapWithdrawTransactionHash}`)
this.finishStep({
isBchWithdrawn: true,
}, { step: 'withdraw-bch' })
}
import debug from 'debug';
const log = debug('info');
export default {
start: (key) => {
const start = process.hrtime();
log(`Loading: ${key}`);
return start;
},
end: (start) => {
const end = process.hrtime(start);
log(`Elapsed: ${end[1] / 1000000}ms`);
return end;
},
};