@activepieces/shared
Advanced tools
Comparing version 0.3.36 to 0.3.37
{ | ||
"name": "@activepieces/shared", | ||
"version": "0.3.36", | ||
"version": "0.3.37", | ||
"type": "commonjs", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
@@ -7,5 +7,8 @@ import { StepOutput } from './step-output'; | ||
export declare class ExecutionState { | ||
private _taskCount; | ||
steps: Record<string, StepOutput>; | ||
lastStepState: Record<string, unknown>; | ||
constructor(executionState?: ExecutionState); | ||
get taskCount(): number; | ||
private adjustTaskCount; | ||
insertStep(stepOutput: StepOutput, stepName: string, ancestors: [string, number][]): void; | ||
@@ -12,0 +15,0 @@ updateLastStep(outputOnly: unknown, stepName: string): void; |
@@ -7,5 +7,7 @@ "use strict"; | ||
constructor(executionState) { | ||
this._taskCount = 0; | ||
this.steps = {}; | ||
this.lastStepState = {}; | ||
if (executionState) { | ||
this._taskCount = executionState.taskCount; | ||
this.steps = executionState.steps; | ||
@@ -15,4 +17,20 @@ this.lastStepState = executionState.lastStepState; | ||
} | ||
get taskCount() { | ||
return this._taskCount; | ||
} | ||
adjustTaskCount({ stepOutput }) { | ||
const nonCountableSteps = [ | ||
action_1.ActionType.BRANCH, | ||
action_1.ActionType.LOOP_ON_ITEMS, | ||
]; | ||
const stepIsCountable = !nonCountableSteps.includes(stepOutput.type); | ||
if (stepIsCountable) { | ||
this._taskCount += 1; | ||
} | ||
} | ||
insertStep(stepOutput, stepName, ancestors) { | ||
const targetMap = this.getTargetMap(ancestors); | ||
this.adjustTaskCount({ | ||
stepOutput, | ||
}); | ||
targetMap[stepName] = stepOutput; | ||
@@ -19,0 +37,0 @@ this.updateLastStep(stepOutput.output, stepName); |
Sorry, the diff of this file is not supported yet
272613
3854