Fix some compilation errors.
This commit is contained in:
parent
75ab9d2e8c
commit
580ae005f4
@ -1,5 +1,5 @@
|
|||||||
import debug from 'debug'
|
import createDebug from 'debug'
|
||||||
debug = debug('xo:api')
|
const debug = createDebug('xo:api')
|
||||||
|
|
||||||
import assign from 'lodash.assign'
|
import assign from 'lodash.assign'
|
||||||
import Bluebird from 'bluebird'
|
import Bluebird from 'bluebird'
|
||||||
|
@ -8,7 +8,7 @@ import {mapInPlace} from './utils'
|
|||||||
|
|
||||||
// ===================================================================
|
// ===================================================================
|
||||||
|
|
||||||
export class ModelAlreadyExists {
|
export class ModelAlreadyExists extends BaseError {
|
||||||
constructor (id) {
|
constructor (id) {
|
||||||
super('this model already exists: ' + id)
|
super('this model already exists: ' + id)
|
||||||
}
|
}
|
||||||
|
20
src/utils.js
20
src/utils.js
@ -8,8 +8,6 @@ import xml2js from 'xml2js'
|
|||||||
import {promisify, method} from 'bluebird'
|
import {promisify, method} from 'bluebird'
|
||||||
import {randomBytes} from 'crypto'
|
import {randomBytes} from 'crypto'
|
||||||
|
|
||||||
randomBytes = promisify(randomBytes)
|
|
||||||
|
|
||||||
/* eslint no-lone-blocks: 0 */
|
/* eslint no-lone-blocks: 0 */
|
||||||
|
|
||||||
// ===================================================================
|
// ===================================================================
|
||||||
@ -26,12 +24,13 @@ export const ensureArray = (value) => {
|
|||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
|
|
||||||
// Generate a secure random Base64 string.
|
// Generate a secure random Base64 string.
|
||||||
export const generateToken = (n = 32) => randomBytes(n).then(base64url)
|
export const generateToken = (function (randomBytes) {
|
||||||
|
return (n = 32) => randomBytes(n).then(base64url)
|
||||||
|
})(promisify(randomBytes))
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
|
|
||||||
export let formatXml
|
export const formatXml = (function () {
|
||||||
{
|
|
||||||
const builder = new xml2js.Builder({
|
const builder = new xml2js.Builder({
|
||||||
xmldec: {
|
xmldec: {
|
||||||
// Do not include an XML header.
|
// Do not include an XML header.
|
||||||
@ -44,17 +43,16 @@ export let formatXml
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
formatXml = (...args) => builder.buildObject(...args)
|
return (...args) => builder.buildObject(...args)
|
||||||
}
|
})()
|
||||||
|
|
||||||
export let parseXml
|
export const parseXml = (function () {
|
||||||
{
|
|
||||||
const opts = {
|
const opts = {
|
||||||
mergeAttrs: true,
|
mergeAttrs: true,
|
||||||
explicitArray: false
|
explicitArray: false
|
||||||
}
|
}
|
||||||
|
|
||||||
parseXml = (xml) => {
|
return (xml) => {
|
||||||
let result
|
let result
|
||||||
|
|
||||||
// xml2js.parseString() use a callback for synchronous code.
|
// xml2js.parseString() use a callback for synchronous code.
|
||||||
@ -68,7 +66,7 @@ export let parseXml
|
|||||||
|
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
}
|
})()
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import assign from 'lodash.assign'
|
import assign from 'lodash.assign'
|
||||||
import debug from 'debug'
|
import createDebug from 'debug'
|
||||||
import WebSocket from 'ws'
|
import WebSocket from 'ws'
|
||||||
|
|
||||||
debug = debug('xo:wsProxy')
|
const debug = createDebug('xo:wsProxy')
|
||||||
|
|
||||||
const defaults = {
|
const defaults = {
|
||||||
// Automatically close the client connection when the remote close.
|
// Automatically close the client connection when the remote close.
|
||||||
|
Loading…
Reference in New Issue
Block a user