mirror of
https://github.com/bigchaindb/js-bigchaindb-driver.git
synced 2024-11-24 11:01:28 +01:00
fix: run lint
Signed-off-by: getlarge <ed@getlarge.eu>
This commit is contained in:
parent
611624fd7a
commit
abaa40b269
@ -2,6 +2,8 @@
|
||||
// SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
// Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
/* eslint-disable strict, no-console, object-shorthand, import/no-extraneous-dependencies */
|
||||
|
||||
const { ConcatSource } = require('webpack-sources')
|
||||
|
||||
module.exports = class AddVendorsPlugin {
|
||||
|
@ -19,7 +19,7 @@ export function ResponseError(message, status, requestURI) {
|
||||
this.stack = (new Error()).stack
|
||||
}
|
||||
|
||||
ResponseError.prototype = new Error;
|
||||
ResponseError.prototype = new Error()
|
||||
|
||||
/**
|
||||
* @private
|
||||
@ -50,12 +50,15 @@ function handleResponse(res) {
|
||||
// If status is not a 2xx (based on Response.ok), assume it's an error
|
||||
// See https://developer.mozilla.org/en-US/docs/Web/API/GlobalFetch/fetch
|
||||
if (!(res && res.ok)) {
|
||||
throw new ResponseError('HTTP Error: Requested page not reachable', `${res.status} ${res.statusText}`, res.url)
|
||||
throw new ResponseError(
|
||||
'HTTP Error: Requested page not reachable',
|
||||
`${res.status} ${res.statusText}`,
|
||||
res.url
|
||||
)
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @private
|
||||
* imported from https://github.com/bigchaindb/js-utility-belt/
|
||||
|
@ -22,7 +22,7 @@ export default class Connection {
|
||||
// This driver implements the BEP-14 https://github.com/bigchaindb/BEPs/tree/master/14
|
||||
constructor(nodes, headers = {}, timeout = DEFAULT_TIMEOUT) {
|
||||
// Copy object
|
||||
this.headers = Object.assign({}, headers)
|
||||
this.headers = { ...headers }
|
||||
|
||||
// Validate headers
|
||||
Object.keys(headers).forEach(header => {
|
||||
@ -49,7 +49,7 @@ export default class Connection {
|
||||
if (typeof node === 'string') {
|
||||
return { 'endpoint': node, 'headers': headers }
|
||||
} else {
|
||||
const allHeaders = Object.assign({}, headers, node.headers)
|
||||
const allHeaders = { ...headers, ...node.headers }
|
||||
return { 'endpoint': node.endpoint, 'headers': allHeaders }
|
||||
}
|
||||
}
|
||||
@ -155,7 +155,6 @@ export default class Connection {
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param transaction
|
||||
*/
|
||||
@ -166,7 +165,6 @@ export default class Connection {
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param transaction
|
||||
*/
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
import { sprintf } from 'sprintf-js'
|
||||
|
||||
|
||||
// Regexes taken from or inspired by sprintf-js
|
||||
const Regex = {
|
||||
TEMPLATE_LITERAL: /\${([^)]+?)}/g,
|
||||
|
@ -19,7 +19,6 @@ const ERROR_FROM_SERVER = 'HTTP Error: Requested page not reachable'
|
||||
* default settings, and response handling.
|
||||
*/
|
||||
|
||||
|
||||
export default class Request {
|
||||
constructor(node) {
|
||||
this.node = node
|
||||
@ -33,14 +32,15 @@ export default class Request {
|
||||
return Promise.reject(new Error('Request was not given a url.'))
|
||||
}
|
||||
// Load default fetch configuration and remove any falsy query parameters
|
||||
const requestConfig = Object.assign({}, this.node.headers, DEFAULT_REQUEST_CONFIG, config, {
|
||||
const requestConfig = {
|
||||
...this.node.headers,
|
||||
...DEFAULT_REQUEST_CONFIG,
|
||||
...config,
|
||||
query: config.query && sanitize(config.query)
|
||||
})
|
||||
}
|
||||
const apiUrl = this.node.endpoint + urlPath
|
||||
if (requestConfig.jsonBody) {
|
||||
requestConfig.headers = Object.assign({}, requestConfig.headers, {
|
||||
'Content-Type': 'application/json'
|
||||
})
|
||||
requestConfig.headers = { ...requestConfig.headers, 'Content-Type': 'application/json' }
|
||||
}
|
||||
|
||||
// If connectionError occurs, a timestamp equal to now +
|
||||
|
@ -2,9 +2,8 @@
|
||||
// SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
// Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
import 'core-js/features/array/includes';
|
||||
import 'core-js/features/object/entries';
|
||||
|
||||
import 'core-js/features/array/includes'
|
||||
import 'core-js/features/object/entries'
|
||||
|
||||
/**
|
||||
* @private
|
||||
@ -32,7 +31,7 @@ function filterFromObject(obj, filter, { isInclusion = true } = {}) {
|
||||
*/
|
||||
function applyFilterOnObject(obj, filterFn) {
|
||||
if (filterFn == null) {
|
||||
return Object.assign({}, obj)
|
||||
return { ...obj }
|
||||
}
|
||||
|
||||
const filteredObj = {}
|
||||
|
@ -6,7 +6,6 @@ import 'core-js/features/object/entries'
|
||||
import decamelize from 'decamelize'
|
||||
import queryString from 'query-string'
|
||||
|
||||
|
||||
/**
|
||||
* @private
|
||||
* imported from https://github.com/bigchaindb/js-utility-belt/
|
||||
|
@ -166,7 +166,7 @@ export default class Transaction {
|
||||
subconditions.forEach((subcondition) => {
|
||||
// TODO: add support for Condition
|
||||
thresholdCondition.addSubfulfillment(subcondition)
|
||||
//? Should be thresholdCondition.addSubcondition(subcondition)
|
||||
// ? Should be thresholdCondition.addSubcondition(subcondition)
|
||||
})
|
||||
|
||||
if (json) {
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
import Request from './request'
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @private
|
||||
@ -13,7 +12,6 @@ import Request from './request'
|
||||
* customizable in the future).
|
||||
*/
|
||||
|
||||
|
||||
export default class Transport {
|
||||
constructor(nodes, timeout) {
|
||||
this.connectionPool = []
|
||||
|
@ -2,8 +2,8 @@
|
||||
// SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
// Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
import base58 from 'bs58'
|
||||
import { createHash } from 'crypto'
|
||||
import base58 from 'bs58'
|
||||
import { Ed25519Sha256 } from 'crypto-conditions'
|
||||
import { Transaction, Ed25519Keypair } from '../src'
|
||||
// TODO: Find out if ava has something like conftest, if so put this there.
|
||||
@ -34,13 +34,14 @@ export const bobCondition = Transaction.makeEd25519Condition(bob.publicKey)
|
||||
export const bobOutput = Transaction.makeOutput(bobCondition)
|
||||
|
||||
export function delegatedSignTransaction(...keyPairs) {
|
||||
return function sign(serializedTransaction, input, index) {
|
||||
return function sign(serializedTransaction, input) {
|
||||
const transactionUniqueFulfillment = input.fulfills ? serializedTransaction
|
||||
.concat(input.fulfills.transaction_id)
|
||||
.concat(input.fulfills.output_index) : serializedTransaction
|
||||
const transactionHash = createHash('sha3-256').update(transactionUniqueFulfillment).digest()
|
||||
const filteredKeyPairs = keyPairs.filter(({ publicKey }) =>
|
||||
input.owners_before.includes(publicKey))
|
||||
const filteredKeyPairs = keyPairs.filter(
|
||||
({ publicKey }) => input.owners_before.includes(publicKey)
|
||||
)
|
||||
|
||||
const ed25519Fulfillment = new Ed25519Sha256()
|
||||
filteredKeyPairs.forEach(keyPair => {
|
||||
|
@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
// Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
/* eslint-disable strict, no-console, object-shorthand */
|
||||
/* eslint-disable strict, no-console, object-shorthand, import/no-extraneous-dependencies */
|
||||
|
||||
'use strict'
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
// Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
/* eslint-disable strict, no-console, object-shorthand */
|
||||
/* eslint-disable strict, no-console, object-shorthand, import/no-extraneous-dependencies */
|
||||
|
||||
'use strict'
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user