1
0
mirror of https://github.com/oceanprotocol-archive/squid-js.git synced 2024-02-02 15:31:51 +01:00

Fix linter errors.

This commit is contained in:
Pedro Gutiérrez 2019-07-12 16:56:01 +02:00 committed by Pedro Gutiérrez
parent 88b8eb06c6
commit cdbc4c93a1
4 changed files with 32 additions and 12 deletions

View File

@ -95,7 +95,11 @@ export class Brizo extends Instantiable {
consumeUrl += `&signature=${signature}`
try {
await this.ocean.utils.fetch.downloadFile(consumeUrl, destination, i)
await this.ocean.utils.fetch.downloadFile(
consumeUrl,
destination,
i
)
} catch (e) {
this.logger.error('Error consuming assets')
this.logger.error(e)

View File

@ -268,8 +268,10 @@ export class OceanAssets extends Instantiable {
ddo.findServiceByType('Authorization').serviceEndpoint
)
const downloads = files
.filter(({index: i}) => index === -1 || index === i)
.map(({url, index: i}) => this.ocean.utils.fetch.downloadFile(url, resultPath, i))
.filter(({ index: i }) => index === -1 || index === i)
.map(({ url, index: i }) =>
this.ocean.utils.fetch.downloadFile(url, resultPath, i)
)
await Promise.all(downloads)
}
this.logger.log('Files consumed')

View File

@ -1,5 +1,5 @@
import SecretStore from "@oceanprotocol/secret-store-client"
import SecretStoreConfig from "@oceanprotocol/secret-store-client/dist/models/SecretStoreConfig"
import SecretStore from '@oceanprotocol/secret-store-client'
import SecretStoreConfig from '@oceanprotocol/secret-store-client/dist/models/SecretStoreConfig'
import Account from './Account'
import { noDidPrefixed } from '../utils'
@ -59,13 +59,20 @@ export class OceanSecretStore extends Instantiable {
* @param {string} consumer cONSUMER account.
* @return {Promise<string>} Encrypted text.
*/
public async decrypt(did: string, content: string, consumer?: Account, secretStoreUrl?: string): Promise<any> {
return await this.getSecretStoreByAccount(consumer, secretStoreUrl)
.decryptDocument(noDidPrefixed(did), content)
public async decrypt(
did: string,
content: string,
consumer?: Account,
secretStoreUrl?: string
): Promise<any> {
return this.getSecretStoreByAccount(
consumer,
secretStoreUrl
).decryptDocument(noDidPrefixed(did), content)
}
private getSecretStoreByAccount(account: Account, secretStoreUrl?: string) {
const config: any = {...this.config}
const config: any = { ...this.config }
if (account) {
config.address = account.getId()
}
@ -79,8 +86,14 @@ export class OceanSecretStore extends Instantiable {
}
private getSecretStore(config: SecretStoreConfig): SecretStore {
const {secretStoreUri, parityUri, password, address, threshold} = config
config = {secretStoreUri, parityUri, password, address, threshold}
const {
secretStoreUri,
parityUri,
password,
address,
threshold
} = config
config = { secretStoreUri, parityUri, password, address, threshold }
return new SecretStore(config)
}

View File

@ -1,9 +1,10 @@
import fetch, { BodyInit, RequestInit, Response } from 'node-fetch'
import * as fs from 'fs'
import save = require('save-file')
import { Instantiable, InstantiableConfig } from '../../Instantiable.abstract'
import save = require('save-file')
/**
* Provides a common interface to web services.
*/