From 6e2289b27ddc8643076385ee3fe8cfb743d4ecfb Mon Sep 17 00:00:00 2001 From: alexcos20 Date: Sat, 1 Feb 2020 15:42:02 +0200 Subject: [PATCH] lint fix --- src/brizo/Brizo.ts | 2 +- src/ocean/OceanCompute.ts | 55 +++++++++++++++++++-------------------- 2 files changed, 28 insertions(+), 29 deletions(-) diff --git a/src/brizo/Brizo.ts b/src/brizo/Brizo.ts index 4bfd8a6..3a85b32 100644 --- a/src/brizo/Brizo.ts +++ b/src/brizo/Brizo.ts @@ -117,7 +117,7 @@ export class Brizo extends Instantiable { algorithmDid?: string, algorithmMeta?: MetaData, jobId?: string, - output?: Object + output?: Record ): Promise { const signature = await this.createSignature(consumerAccount, serviceAgreementId) const address = consumerAccount.getId() diff --git a/src/ocean/OceanCompute.ts b/src/ocean/OceanCompute.ts index 96eb1dd..86aece8 100644 --- a/src/ocean/OceanCompute.ts +++ b/src/ocean/OceanCompute.ts @@ -78,43 +78,42 @@ export class OceanCompute extends Instantiable { * return minimal output object * @return {Promise} Returns output object */ - public async minimal_output_object():Promise { - var minimal_output=Object() - minimal_output["publishAlgorithmLog"]=false - minimal_output["publishOutput"]=false - return minimal_output + public async getminimaloutput(): Promise> { + const minimaloutput = Object() + minimaloutput.publishAlgorithmLog = false + minimaloutput.publishOutput = false + return minimaloutput } + /** * Check the output object and add default properties if needed * @param {Account} consumerAccount The account of the consumer ordering the service. * @param {Object} output Output section used for publishing the result. * @return {Promise} Returns output object */ - public async check_output_dict( - consumerAccount:Account, - output?:Object - ): Promise { - if (!output){ - //build a minimal object and return it - return (await this.minimal_output_object()) + public async checkoutput( + consumerAccount: Account, + output?: Record + ): Promise> { + if (!output) { + // build a minimal object and return it + return this.getminimaloutput() } - if((!output["publishAlgorithmLog"] || output["publishAlgorithmLog"]==false) && (!output["publishOutput"] || output["publishOutput"]==false)){ - return (await this.minimal_output_object()) + if ( + (!output.publishAlgorithmLog || output.publishAlgorithmLog === false) && + (!output.publishOutput || output.publishOutput === false) + ) { + return this.getminimaloutput() } - if(!output["brizoAddress"]) - output["brizoAddress"]=this.config.brizoAddress - if(!output["brizoUrl"]) - output["brizoUrl"]=this.config.brizoUri - if(!output["metadataUrl"]) - output["metadataUrl"]=this.config.aquariusUri - if(!output["nodeUri"]) - output["nodeUri"]=this.config.nodeUri - if(!output["owner"]) - output["owner"]=consumerAccount.getId() - if(!output["secretStoreUrl"]) - output["secretStoreUrl"]=this.config.secretStoreUri + if (!output.brizoAddress) output.brizoAddress = this.config.brizoAddress + if (!output.brizoUrl) output.brizoUrl = this.config.brizoUri + if (!output.metadataUrl) output.metadataUrl = this.config.aquariusUri + if (!output.nodeUri) output.nodeUri = this.config.nodeUri + if (!output.owner) output.owner = consumerAccount.getId() + if (!output.secretStoreUrl) output.secretStoreUrl = this.config.secretStoreUri return output } + /** * Start the execution of a compute job. * @param {Account} consumerAccount The account of the consumer ordering the service. @@ -129,9 +128,9 @@ export class OceanCompute extends Instantiable { agreementId: string, algorithmDid?: string, algorithmMeta?: MetaData, - output?:Object + output?: Record ): Promise { - output=await this.check_output_dict(consumerAccount,output) + output = await this.checkoutput(consumerAccount, output) const status = await this.ocean.brizo.compute( 'post', agreementId,