@wmfs/statebox
Advanced tools
Comparing version 1.3.0 to 1.3.1
@@ -0,1 +1,8 @@ | ||
## [1.3.1](https://github.com/wmfs/statebox/compare/v1.3.0...v1.3.1) (2018-07-26) | ||
### 🐛 Bug Fixes | ||
* Issue [#20](https://github.com/wmfs/statebox/issues/20): Parallel States and aggregated results ([97dab42](https://github.com/wmfs/statebox/commit/97dab42)) | ||
# [1.3.0](https://github.com/wmfs/statebox/compare/v1.2.1...v1.3.0) (2018-07-19) | ||
@@ -2,0 +9,0 @@ |
'use strict' | ||
const Status = require('./Status') | ||
const merge = require('deepmerge') | ||
@@ -9,4 +10,9 @@ module.exports = class ParallelBranchTracker { | ||
this.childExecutions = {} | ||
this.ctx = {} | ||
} | ||
addToCtx (ctx) { | ||
this.ctx = merge(this.ctx, ctx) | ||
} | ||
addParentExecutionName (parentExecutionName) { | ||
@@ -13,0 +19,0 @@ this.parentExecutions[parentExecutionName] = { |
@@ -159,2 +159,3 @@ 'use strict' | ||
const tracker = this.parallelBranchTracker | ||
tracker.addToCtx(ctx) | ||
tracker.registerChildExecutionEnd(executionDescription.executionName) | ||
@@ -164,3 +165,3 @@ const parallelStateStatus = tracker.getParallelTaskStatus(parentExecutionName) | ||
debugPackage(`All branches have now succeeded (executionName='${executionDescription.executionOptions.parentExecutionName}')`) | ||
this.processTaskSuccess(parentExecutionName, ctx) | ||
this.processTaskSuccess(parentExecutionName, tracker.ctx) | ||
} | ||
@@ -167,0 +168,0 @@ } else { |
{ | ||
"name": "@wmfs/statebox", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "Orchestrate Node functions using Amazon States Language", | ||
@@ -28,2 +28,3 @@ "author": "West Midlands Fire Service", | ||
"debug": "3.1.0", | ||
"deepmerge": "2.1.1", | ||
"dottie": "2.0.0", | ||
@@ -30,0 +31,0 @@ "jsonpath": "1.0.0", |
@@ -14,3 +14,4 @@ module.exports = { | ||
parallelFail: require('./parallel-fail-state-machine.json'), | ||
parallelResults: require('./parallel-results-machine.json'), | ||
waitState: require('./wait-state-machine.json') | ||
} |
@@ -296,2 +296,26 @@ /* eslint-env mocha */ | ||
describe('parallel - state machine with parallel states and results', () => { | ||
it('startExecution', async () => { | ||
const executionDescription = await statebox.startExecution( | ||
{ | ||
results: [] | ||
}, | ||
'parallelResults', | ||
{} | ||
) | ||
executionName = executionDescription.executionName | ||
}) | ||
it('waitUntilStoppedRunning', async () => { | ||
const executionDescription = await statebox.waitUntilStoppedRunning(executionName) | ||
expect(executionDescription.status).to.eql('SUCCEEDED') | ||
expect(executionDescription.stateMachineName).to.eql('parallelResults') | ||
expect(executionDescription.currentStateName).to.eql('FG') | ||
expect(executionDescription.ctx.results).to.include('G') | ||
expect(executionDescription.ctx.results).to.include('F') | ||
}) | ||
}) | ||
describe('parallel - state machine with multiple parallel branches', () => { | ||
@@ -298,0 +322,0 @@ // |
Sorry, the diff of this file is not supported yet
122962
66
2884
9
+ Addeddeepmerge@2.1.1
+ Addeddeepmerge@2.1.1(transitive)