chore: update promise-toolbox to v0.10 (#3392)

This commit is contained in:
Julien Fontanet 2018-09-07 14:34:47 +02:00 committed by GitHub
parent 0ad6c073ee
commit b3004a38aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
36 changed files with 68 additions and 62 deletions

View File

@ -25,7 +25,7 @@
"fs-extra": "^7.0.0",
"get-stream": "^4.0.0",
"lodash": "^4.17.4",
"promise-toolbox": "^0.9.5",
"promise-toolbox": "^0.10.1",
"through2": "^2.0.3",
"tmp": "^0.0.33",
"xo-remote-parser": "^0.5.0"

View File

@ -2,8 +2,8 @@
import rimraf from 'rimraf'
import tmp from 'tmp'
import { pFromCallback } from 'promise-toolbox'
import { fromCallback as pFromCallback } from 'promise-toolbox'
import { getHandler } from '.'
const initialDir = process.cwd()

View File

@ -1,5 +1,5 @@
import Smb2 from '@marsaud/smb2'
import { lastly as pFinally } from 'promise-toolbox'
import { pFinally } from 'promise-toolbox'
import RemoteHandlerAbstract from './abstract'

View File

@ -21,7 +21,7 @@
"jest": "^23.0.1",
"lodash": "^4.17.4",
"prettier": "^1.10.2",
"promise-toolbox": "^0.9.5",
"promise-toolbox": "^0.10.1",
"sorted-object": "^2.0.1"
},
"engines": {

View File

@ -40,7 +40,7 @@
"cross-env": "^5.1.3",
"execa": "^1.0.0",
"index-modules": "^0.3.0",
"promise-toolbox": "^0.9.5",
"promise-toolbox": "^0.10.1",
"rimraf": "^2.6.1",
"tmp": "^0.0.33"
},

View File

@ -3,7 +3,7 @@
import execa from 'execa'
import rimraf from 'rimraf'
import tmp from 'tmp'
import { fromCallback as pFromCallback } from 'promise-toolbox'
import { pFromCallback } from 'promise-toolbox'
import command from './commands/info'

View File

@ -24,7 +24,7 @@
"from2": "^2.3.0",
"fs-extra": "^7.0.0",
"limit-concurrency-decorator": "^0.4.0",
"promise-toolbox": "^0.9.5",
"promise-toolbox": "^0.10.1",
"struct-fu": "^1.2.0",
"uuid": "^3.0.1"
},

View File

@ -5,9 +5,9 @@ import fs from 'fs-extra'
import getStream from 'get-stream'
import rimraf from 'rimraf'
import tmp from 'tmp'
import { fromEvent, pFromCallback } from 'promise-toolbox'
import { getHandler } from '@xen-orchestra/fs'
import { randomBytes } from 'crypto'
import { fromEvent, fromCallback as pFromCallback } from 'promise-toolbox'
import chainVhd from './chain'
import createReadStream from './createSyntheticStream'

View File

@ -3,7 +3,7 @@ import execa from 'execa'
import rimraf from 'rimraf'
import tmp from 'tmp'
import { createWriteStream, readFile } from 'fs-promise'
import { fromCallback as pFromCallback, fromEvent } from 'promise-toolbox'
import { fromEvent, pFromCallback } from 'promise-toolbox'
import { createFooter } from './_createFooterHeader'
import createReadableRawVHDStream from './createReadableRawStream'

View File

@ -45,7 +45,7 @@
"make-error": "^1.3.0",
"minimist": "^1.2.0",
"ms": "^2.1.1",
"promise-toolbox": "^0.9.5",
"promise-toolbox": "^0.10.1",
"pw": "0.0.4",
"xmlrpc": "^1.3.2",
"xo-collection": "^0.4.1"

View File

@ -21,12 +21,12 @@ import {
import {
Cancel,
cancelable,
catchPlus as pCatch,
defer,
delay as pDelay,
fromEvents,
lastly,
timeout as pTimeout,
pCatch,
pDelay,
pFinally,
pTimeout,
TimeoutError,
} from 'promise-toolbox'
@ -428,7 +428,7 @@ export class Xapi extends EventEmitter {
this._sessionCall('task.cancel', [taskRef]).catch(noop)
})
return lastly.call(this.watchTask(taskRef), () => {
return pFinally.call(this.watchTask(taskRef), () => {
this._sessionCall('task.destroy', [taskRef]).catch(noop)
})
})

View File

@ -1,6 +1,6 @@
#!/usr/bin/env node
import { delay as pDelay } from 'promise-toolbox'
import { pDelay } from 'promise-toolbox'
import { createClient } from './'

View File

@ -38,7 +38,7 @@
"inquirer": "^6.0.0",
"ldapjs": "^1.0.1",
"lodash": "^4.17.4",
"promise-toolbox": "^0.9.5"
"promise-toolbox": "^0.10.1"
},
"devDependencies": {
"@babel/cli": "7.0.0",

View File

@ -1,5 +1,5 @@
import { forEach, isFinite, isInteger } from 'lodash'
import { forOwn as forOwnAsync } from 'promise-toolbox'
import { pforOwn } from 'promise-toolbox'
import { prompt } from 'inquirer'
// ===================================================================
@ -160,7 +160,7 @@ const promptByType = {
}
}
await forOwnAsync.call(schema.properties || {}, promptProperty)
await pforOwn.call(schema.properties || {}, promptProperty)
return value
},

View File

@ -33,7 +33,7 @@
"dependencies": {
"nodemailer": "^4.4.1",
"nodemailer-markdown": "^1.0.1",
"promise-toolbox": "^0.9.5"
"promise-toolbox": "^0.10.1"
},
"devDependencies": {
"@babel/cli": "^7.0.0",

View File

@ -32,7 +32,7 @@
"node": ">=6"
},
"dependencies": {
"promise-toolbox": "^0.9.5",
"promise-toolbox": "^0.10.1",
"slack-node": "^0.1.8"
},
"devDependencies": {

View File

@ -38,7 +38,7 @@
"handlebars": "^4.0.6",
"html-minifier": "^3.5.8",
"lodash": "^4.17.4",
"promise-toolbox": "^0.9.5"
"promise-toolbox": "^0.10.1"
},
"devDependencies": {
"@babel/cli": "7.0.0",

View File

@ -93,7 +93,7 @@
"passport": "^0.4.0",
"passport-local": "^1.0.0",
"pretty-format": "^23.0.0",
"promise-toolbox": "^0.9.5",
"promise-toolbox": "^0.10.1",
"proxy-agent": "^3.0.0",
"pug": "^2.0.0-rc.4",
"pump": "^3.0.0",

View File

@ -16,11 +16,11 @@ import { randomBytes } from 'crypto'
import { dirname, resolve } from 'path'
import { utcFormat, utcParse } from 'd3-time-format'
import {
all as pAll,
fromCallback,
isPromise,
pAll,
pReflect,
promisify,
reflect as pReflect,
} from 'promise-toolbox'
// ===================================================================
@ -267,19 +267,19 @@ export function pDebug (promise, name) {
//
// Usage: pSettle(promises) or promises::pSettle()
export function pSettle (promises) {
return (this || promises)::pAll(p => p::pReflect())
return (this || promises)::pAll(p => Promise.resolve(p)::pReflect())
}
// -------------------------------------------------------------------
export {
all as pAll,
delay as pDelay,
fromCallback as pFromCallback,
lastly as pFinally,
pAll,
pDelay,
pFinally,
pFromCallback,
pReflect,
promisify,
promisifyAll,
reflect as pReflect,
} from 'promise-toolbox'
// -------------------------------------------------------------------

View File

@ -7,10 +7,10 @@ import tarStream from 'tar-stream'
import vmdkToVhd from 'xo-vmdk-to-vhd'
import {
cancelable,
catchPlus as pCatch,
defer,
fromEvent,
ignoreErrors,
pCatch,
} from 'promise-toolbox'
import { PassThrough } from 'stream'
import { forbiddenOperation } from 'xo-common/api-errors'
@ -1548,23 +1548,21 @@ export default class Xapi extends XapiBase {
return host === undefined
? this.call(
'VM.start',
vm.$ref,
false, // Start paused?
false // Skip pre-boot checks?
)
: this.call(
'VM.start_on',
vm.$ref,
host.$ref,
false,
false
)
'VM.start',
vm.$ref,
false, // Start paused?
false // Skip pre-boot checks?
)
: this.call('VM.start_on', vm.$ref, host.$ref, false, false)
}
async startVm (vmId, hostId, force) {
try {
await this._startVm(this.getObject(vmId), hostId && this.getObject(hostId), force)
await this._startVm(
this.getObject(vmId),
hostId && this.getObject(hostId),
force
)
} catch (e) {
if (e.code === 'OPERATION_BLOCKED') {
throw forbiddenOperation('Start', e.params[1])

View File

@ -1,5 +1,5 @@
import deferrable from 'golike-defer'
import { catchPlus as pCatch, ignoreErrors } from 'promise-toolbox'
import { ignoreErrors, pCatch } from 'promise-toolbox'
import { find, gte, includes, isEmpty, lte, noop } from 'lodash'
import { forEach, mapToArray, parseSize } from '../../utils'

View File

@ -19,7 +19,7 @@ import {
sum,
values,
} from 'lodash'
import { fromEvent as pFromEvent, ignoreErrors } from 'promise-toolbox'
import { pFromEvent, ignoreErrors } from 'promise-toolbox'
import Vhd, {
chainVhd,
createSyntheticStream as createVhdReadStream,

View File

@ -1,7 +1,7 @@
import createDebug from 'debug'
import DepTree from 'deptree'
import { all as pAll } from 'promise-toolbox'
import { mapValues } from 'lodash'
import { pAll } from 'promise-toolbox'
const debug = createDebug('xo:config-management')

View File

@ -25,7 +25,7 @@
"dependencies": {
"child-process-promise": "^2.0.3",
"pipette": "^0.9.3",
"promise-toolbox": "^0.9.5",
"promise-toolbox": "^0.10.1",
"tmp": "^0.0.33",
"vhd-lib": "^0.3.0"
},

View File

@ -2,7 +2,7 @@
import { createReadStream, readFile } from 'fs-extra'
import { exec } from 'child-process-promise'
import { fromCallback as pFromCallback } from 'promise-toolbox'
import { pFromCallback } from 'promise-toolbox'
import rimraf from 'rimraf'
import tmp from 'tmp'

View File

@ -2,7 +2,7 @@
import { createReadStream } from 'fs-extra'
import { exec } from 'child-process-promise'
import { fromCallback as pFromCallback } from 'promise-toolbox'
import { pFromCallback } from 'promise-toolbox'
import rimraf from 'rimraf'
import tmp from 'tmp'

View File

@ -7,7 +7,7 @@ import rimraf from 'rimraf'
import tmp from 'tmp'
import { createReadStream, createWriteStream, stat } from 'fs-extra'
import { fromCallback as pFromCallback } from 'promise-toolbox'
import { pFromCallback } from 'promise-toolbox'
import convertFromVMDK, { readVmdkGrainTable } from '.'
const initialDir = process.cwd()

View File

@ -94,7 +94,7 @@
"moment": "^2.20.1",
"moment-timezone": "^0.5.14",
"notifyjs": "^3.0.0",
"promise-toolbox": "^0.9.5",
"promise-toolbox": "^0.10.1",
"prop-types": "^15.6.0",
"random-password": "^0.1.2",
"react": "^15.4.1",

View File

@ -1,6 +1,6 @@
import PropTypes from 'prop-types'
import React, { Component } from 'react'
import { isPromise } from 'promise-toolbox'
import isPromise from 'promise-toolbox/isPromise'
const toString = value =>
value === undefined ? 'undefined' : JSON.stringify(value, null, 2)

View File

@ -1,7 +1,10 @@
import asap from 'asap'
import cookies from 'cookies-js'
import fpSortBy from 'lodash/fp/sortBy'
import pFinally from 'promise-toolbox/finally'
import React from 'react'
import reflect from 'promise-toolbox/reflect'
import tap from 'promise-toolbox/tap'
import URL from 'url-parse'
import Xo from 'xo-lib'
import { createBackoff } from 'jsonrpc-websocket-client'
@ -20,7 +23,6 @@ import {
sortBy,
throttle,
} from 'lodash'
import { lastly, reflect, tap } from 'promise-toolbox'
import {
forbiddenOperation,
noHostsAvailable,
@ -480,7 +482,7 @@ export const editServer = (server, props) =>
)
export const connectServer = server =>
_call('server.connect', { id: resolveId(server) })::lastly(
_call('server.connect', { id: resolveId(server) })::pFinally(
subscribeServers.forceRefresh
)

View File

@ -1,5 +1,6 @@
import _ from 'intl'
import Component from 'base-component'
import fromCallback from 'promise-toolbox/fromCallback'
import Icon from 'icon'
import Link from 'link'
import NoObjects from 'no-objects'
@ -9,7 +10,6 @@ import Tooltip from 'tooltip'
import Upgrade from 'xoa-upgrade'
import xml2js from 'xml2js'
import { SelectPool } from 'select-objects'
import { fromCallback } from 'promise-toolbox'
import { Container, Row, Col } from 'grid'
import { Card, CardHeader, CardBlock } from 'card'
import { FormattedRelative, FormattedTime } from 'react-intl'

View File

@ -3,6 +3,7 @@ import ActionButton from 'action-button'
import Component from 'base-component'
import filter from 'lodash/filter'
import Icon from 'icon'
import ignoreErrors from 'promise-toolbox/ignoreErrors'
import includes from 'lodash/includes'
import info, { error } from 'notification'
import isEmpty from 'lodash/isEmpty'
@ -16,7 +17,6 @@ import Wizard, { Section } from 'wizard'
import { confirm } from 'modal'
import { connectStore, formatSize } from 'utils'
import { Container, Row, Col } from 'grid'
import { ignoreErrors } from 'promise-toolbox'
import { injectIntl } from 'react-intl'
import { Password, Select, Toggle } from 'form'
import { SelectHost } from 'select-objects'

View File

@ -7,13 +7,13 @@ import GenericInput from 'json-schema-input'
import Icon from 'icon'
import isEmpty from 'lodash/isEmpty'
import map from 'lodash/map'
import pFinally from 'promise-toolbox/finally'
import React from 'react'
import size from 'lodash/size'
import { addSubscriptions } from 'utils'
import { alert } from 'modal'
import { createSelector } from 'reselect'
import { generateUiSchema } from 'xo-json-schema-input'
import { lastly } from 'promise-toolbox'
import { Row, Col } from 'grid'
import {
configurePlugin,
@ -55,7 +55,7 @@ class Plugin extends Component {
const method = event.target.checked
? enablePluginAutoload
: disablePluginAutoload
method(this.props.id)::lastly(() => {
method(this.props.id)::pFinally(() => {
this._updateAutoload = false
})
}

View File

@ -1,7 +1,7 @@
import find from 'lodash/find'
import forEach from 'lodash/forEach'
import fromEvent from 'promise-toolbox/fromEvent'
import xml2js from 'xml2js'
import { fromEvent } from 'promise-toolbox'
import { ensureArray } from 'utils'
import { readVmdkGrainTable } from 'xo-vmdk-to-vhd'

View File

@ -2,6 +2,7 @@ import _ from 'intl'
import ActionButton from 'action-button'
import Component from 'base-component'
import Icon from 'icon'
import ignoreErrors from 'promise-toolbox/ignoreErrors'
import Link from 'link'
import Page from '../page'
import React from 'react'
@ -9,7 +10,6 @@ import SortedTable from 'sorted-table'
import Tooltip from 'tooltip'
import { Container, Col, Row } from 'grid'
import { get } from 'xo-defined'
import { ignoreErrors } from 'promise-toolbox'
import { every, filter, find, flatten, forEach, isEmpty, map } from 'lodash'
import { createGetObjectsOfType, createSelector, isAdmin } from 'selectors'
import {

View File

@ -9071,6 +9071,12 @@ promise-polyfill@^6.0.1:
version "6.1.0"
resolved "https://registry.yarnpkg.com/promise-polyfill/-/promise-polyfill-6.1.0.tgz#dfa96943ea9c121fca4de9b5868cb39d3472e057"
promise-toolbox@^0.10.1:
version "0.10.1"
resolved "https://registry.yarnpkg.com/promise-toolbox/-/promise-toolbox-0.10.1.tgz#1049bab6b20fad9b8ad217d22fa91d680b4305b9"
dependencies:
make-error "^1.3.2"
promise-toolbox@^0.8.0:
version "0.8.3"
resolved "https://registry.yarnpkg.com/promise-toolbox/-/promise-toolbox-0.8.3.tgz#b757232a21d246d8702df50da6784932dd0f5348"