1
0
mirror of https://github.com/oceanprotocol/ocean.js.git synced 2024-11-26 20:39:05 +01:00

fixed lint errors

This commit is contained in:
Bogdan Fazakas 2021-06-08 14:06:23 +03:00
parent 200e0d8832
commit 0786c32a7b
5 changed files with 22 additions and 48 deletions

View File

@ -47,10 +47,7 @@ export class DataTokens {
* Generate new datatoken name & symbol from a word list * Generate new datatoken name & symbol from a word list
* @return {<{ name: String; symbol: String }>} datatoken name & symbol. Produces e.g. "Endemic Jellyfish Token" & "ENDJEL-45" * @return {<{ name: String; symbol: String }>} datatoken name & symbol. Produces e.g. "Endemic Jellyfish Token" & "ENDJEL-45"
*/ */
public generateDtName(wordList?: { public generateDtName(wordList?: { nouns: string[]; adjectives: string[] }): {
nouns: string[]
adjectives: string[]
}): {
name: string name: string
symbol: string symbol: string
} { } {

View File

@ -641,9 +641,8 @@ export class Compute extends Instantiable {
} }
if (typeof ddo.service[serviceIndex] === 'undefined') return null if (typeof ddo.service[serviceIndex] === 'undefined') return null
if (ddo.service[serviceIndex].type !== 'compute') return null if (ddo.service[serviceIndex].type !== 'compute') return null
ddo.service[ ddo.service[serviceIndex].attributes.main.privacy.allowAllPublishedAlgorithms =
serviceIndex newState
].attributes.main.privacy.allowAllPublishedAlgorithms = newState
return ddo return ddo
} }
@ -758,13 +757,12 @@ export class Compute extends Instantiable {
if (ddo.service[serviceIndex].type !== 'compute') return ddo if (ddo.service[serviceIndex].type !== 'compute') return ddo
if (!ddo.service[serviceIndex].attributes.main.privacy.publisherTrustedAlgorithms) if (!ddo.service[serviceIndex].attributes.main.privacy.publisherTrustedAlgorithms)
return ddo return ddo
ddo.service[ ddo.service[serviceIndex].attributes.main.privacy.publisherTrustedAlgorithms =
serviceIndex ddo.service[serviceIndex].attributes.main.privacy.publisherTrustedAlgorithms.filter(
].attributes.main.privacy.publisherTrustedAlgorithms = ddo.service[ function (el) {
serviceIndex return el.did !== algoDid
].attributes.main.privacy.publisherTrustedAlgorithms.filter(function (el) { }
return el.did !== algoDid )
})
return ddo return ddo
} }
} }

View File

@ -150,14 +150,8 @@ export class ConfigHelper {
// use the defaults first // use the defaults first
let configAddresses: Partial<ConfigHelperConfig> let configAddresses: Partial<ConfigHelperConfig>
if (DefaultContractsAddresses[network]) { if (DefaultContractsAddresses[network]) {
const { const { DTFactory, BFactory, FixedRateExchange, Dispenser, Metadata, Ocean } =
DTFactory, DefaultContractsAddresses[network]
BFactory,
FixedRateExchange,
Dispenser,
Metadata,
Ocean
} = DefaultContractsAddresses[network]
configAddresses = { configAddresses = {
factoryAddress: DTFactory, factoryAddress: DTFactory,
poolFactoryAddress: BFactory, poolFactoryAddress: BFactory,
@ -178,14 +172,8 @@ export class ConfigHelper {
'utf8' 'utf8'
) )
) )
const { const { DTFactory, BFactory, FixedRateExchange, Dispenser, Metadata, Ocean } =
DTFactory, data[network]
BFactory,
FixedRateExchange,
Dispenser,
Metadata,
Ocean
} = data[network]
configAddresses = { configAddresses = {
factoryAddress: DTFactory, factoryAddress: DTFactory,
poolFactoryAddress: BFactory, poolFactoryAddress: BFactory,

View File

@ -17,9 +17,7 @@ export class SubscribablePromise<T extends any, P extends any> {
setTimeout(() => this.init(executor), 1) setTimeout(() => this.init(executor), 1)
} }
public subscribe( public subscribe(onNext: (next: T) => void): {
onNext: (next: T) => void
): {
unsubscribe: () => boolean unsubscribe: () => boolean
} { } {
return this.observer.subscribe(onNext) return this.observer.subscribe(onNext)

View File

@ -104,8 +104,7 @@ describe('Compute flow', () => {
language: 'js', language: 'js',
format: 'docker-image', format: 'docker-image',
version: '0.1', version: '0.1',
url: url: 'https://raw.githubusercontent.com/oceanprotocol/test-algorithm/master/javascript/algo.js',
'https://raw.githubusercontent.com/oceanprotocol/test-algorithm/master/javascript/algo.js',
container: { container: {
entrypoint: 'node $ALGO', entrypoint: 'node $ALGO',
image: 'node', image: 'node',
@ -250,8 +249,7 @@ describe('Compute flow', () => {
license: 'CC-BY', license: 'CC-BY',
files: [ files: [
{ {
url: url: 'https://raw.githubusercontent.com/tbertinmahieux/MSongsDB/master/Tasks_Demos/CoverSongs/shs_dataset_test.txt',
'https://raw.githubusercontent.com/tbertinmahieux/MSongsDB/master/Tasks_Demos/CoverSongs/shs_dataset_test.txt',
checksum: 'efb2c764274b745f5fc37f97c6b0e764', checksum: 'efb2c764274b745f5fc37f97c6b0e764',
contentLength: '4535431', contentLength: '4535431',
contentType: 'text/csv', contentType: 'text/csv',
@ -487,8 +485,7 @@ describe('Compute flow', () => {
license: 'CC-BY', license: 'CC-BY',
files: [ files: [
{ {
url: url: 'https://raw.githubusercontent.com/oceanprotocol/test-algorithm/master/javascript/algo.js',
'https://raw.githubusercontent.com/oceanprotocol/test-algorithm/master/javascript/algo.js',
contentType: 'text/js', contentType: 'text/js',
encoding: 'UTF-8' encoding: 'UTF-8'
} }
@ -540,8 +537,7 @@ describe('Compute flow', () => {
license: 'CC-BY', license: 'CC-BY',
files: [ files: [
{ {
url: url: 'https://raw.githubusercontent.com/oceanprotocol/test-algorithm/master/javascript/algo.js',
'https://raw.githubusercontent.com/oceanprotocol/test-algorithm/master/javascript/algo.js',
contentType: 'text/js', contentType: 'text/js',
encoding: 'UTF-8' encoding: 'UTF-8'
} }
@ -602,8 +598,7 @@ describe('Compute flow', () => {
license: 'CC-BY', license: 'CC-BY',
files: [ files: [
{ {
url: url: 'https://raw.githubusercontent.com/oceanprotocol/test-algorithm/master/javascript/algo.js',
'https://raw.githubusercontent.com/oceanprotocol/test-algorithm/master/javascript/algo.js',
contentType: 'text/js', contentType: 'text/js',
encoding: 'UTF-8' encoding: 'UTF-8'
} }
@ -667,8 +662,7 @@ describe('Compute flow', () => {
license: 'CC-BY', license: 'CC-BY',
files: [ files: [
{ {
url: url: 'https://raw.githubusercontent.com/oceanprotocol/test-algorithm/master/javascript/algo.js',
'https://raw.githubusercontent.com/oceanprotocol/test-algorithm/master/javascript/algo.js',
contentType: 'text/js', contentType: 'text/js',
encoding: 'UTF-8' encoding: 'UTF-8'
} }
@ -1089,9 +1083,8 @@ describe('Compute flow', () => {
algorithmAssetRemoteProviderWithCompute != null, algorithmAssetRemoteProviderWithCompute != null,
'algorithmAsset should not be null' 'algorithmAsset should not be null'
) )
const serviceAlgo = algorithmAssetRemoteProviderWithCompute.findServiceByType( const serviceAlgo =
'compute' algorithmAssetRemoteProviderWithCompute.findServiceByType('compute')
)
assert(serviceAlgo != null, 'serviceAlgo should not be null') assert(serviceAlgo != null, 'serviceAlgo should not be null')
// get the compute address first // get the compute address first
computeAddress = await ocean.compute.getComputeAddress(ddo.id, computeService.index) computeAddress = await ocean.compute.getComputeAddress(ddo.id, computeService.index)