From 306a9975bceff0aa4c15beaf4e873a7f2665939d Mon Sep 17 00:00:00 2001 From: Simon Larsen Date: Wed, 1 Mar 2023 22:20:15 +0000 Subject: [PATCH] fix lint. --- CommonServer/Infrastructure/Queue.ts | 3 +- Workflow/Services/RunWorkflow.ts | 46 ++++++++++++++-------------- 2 files changed, 24 insertions(+), 25 deletions(-) diff --git a/CommonServer/Infrastructure/Queue.ts b/CommonServer/Infrastructure/Queue.ts index 0f33a9ed2a..383a13db61 100644 --- a/CommonServer/Infrastructure/Queue.ts +++ b/CommonServer/Infrastructure/Queue.ts @@ -23,8 +23,7 @@ export default class Queue { queueName: QueueName, jobId: string ): Promise { - - if(!jobId){ + if (!jobId) { return; } diff --git a/Workflow/Services/RunWorkflow.ts b/Workflow/Services/RunWorkflow.ts index 116c0a9e2c..4f15ffabb9 100644 --- a/Workflow/Services/RunWorkflow.ts +++ b/Workflow/Services/RunWorkflow.ts @@ -158,8 +158,8 @@ export default class RunWorkflow { if (didWorkflowTimeOut) { throw new TimeoutException( 'Workflow execution time was more than ' + - runProps.timeout + - 'ms and workflow timed-out.' + runProps.timeout + + 'ms and workflow timed-out.' ); } @@ -171,8 +171,8 @@ export default class RunWorkflow { if (componentsExecuted.includes(executeComponentId)) { throw new BadDataException( 'Cyclic Workflow Detected. Cannot execute ' + - executeComponentId + - ' when it has already been executed.' + executeComponentId + + ' when it has already been executed.' ); } @@ -186,8 +186,8 @@ export default class RunWorkflow { if (!stackItem) { throw new BadDataException( 'Component with ID ' + - executeComponentId + - ' not found.' + executeComponentId + + ' not found.' ); } @@ -253,7 +253,7 @@ export default class RunWorkflow { this.log(result.returnValues); this.log( 'Executing Port: ' + result.executePort?.title || - '' + '' ); storageMap.local.components[stackItem.node.id] = { @@ -387,29 +387,29 @@ export default class RunWorkflow { argumentContent.toString().includes('{{') && argumentContent.toString().includes('}}') ) { + let argumentContentCopy: string = argumentContent.toString(); + const variablesInArgument: Array = []; + const regex: RegExp = /{{(.*?)}}/g; // Find all matches of the regular expression and capture the word between the braces {{x}} => x - - let argumentContentCopy = argumentContent.toString(); - const variablesInArgument = []; - - const regex = /{{(.*?)}}/g // Find all matches of the regular expression and capture the word between the braces {{x}} => x - - - let match; + let match: RegExpExecArray | null = null; while ((match = regex.exec(argumentContentCopy)) !== null) { - variablesInArgument.push(match[1]); + if (match[1]) { + variablesInArgument.push(match[1]); + } } - for(const variable of variablesInArgument){ - - const value = deepFind( + for (const variable of variablesInArgument) { + const value: string = deepFind( storageMap as any, variable as any ); - argumentContentCopy = argumentContentCopy.replace("{{"+variable+"}}", value); + argumentContentCopy = argumentContentCopy.replace( + '{{' + variable + '}}', + value + ); } argumentContent = argumentContentCopy; @@ -531,8 +531,8 @@ export default class RunWorkflow { } else { this.logs.push( OneUptimeDate.getCurrentDateAsFormattedString() + - ': ' + - JSON.stringify(data) + ': ' + + JSON.stringify(data) ); } } @@ -606,7 +606,7 @@ export default class RunWorkflow { const trigger: any | undefined = nodes.find((n: any) => { return ( (n.data as NodeDataProp).componentType === - ComponentType.Trigger && + ComponentType.Trigger && (n.data as NodeDataProp).nodeType === NodeType.Node ); });