This version introduces experimental support for workflow persistence. Please refer to the machine/src/activities/signal-activity/signal-activity-persistence.spec.ts
file.
This version introduces the signal activity. The signal activity stops the execution of the workflow machine and waits for a signal.
This version introduces the parallel activity. The parallel activity allows to execute in the same time many activities.
Breaking Changes
- The
getStatePath
method in theWorkflowMachineSnapshot
class is deleted. Please use thetryGetStatePath
method or thegetStatePaths
method instead.
This version adds a possibility to stop a workflow machine. To stop a workflow machine, you should call the tryStop()
method of the WorkflowMachineInterpreter
class.
This version adds a new feature to the fork
activity. Now it's possible to skip all branches. The handler of the fork
activity should return a value returned by the skip()
function.
createForkActivity<BranchedStep, TestGlobalState>('if', {
init: () => ({ /* ... */ }),
handler: async (step, globalState, activityState) => {
// ...
return skip();
}
})
This version simplifies error handling:
- The
getSnapshot()
method now returns an instance of theWorkflowMachineSnapshot
class, which includes three new methods:isFinished()
,isFailed()
, andisInterrupted()
. Additionally, you can retrieve the id of the last executing step by calling thetryGetCurrentStepId()
method. - The
unhandledError
property of the snapshot class is always an instance of theMachineUnhandledError
class.
Updated the sequential-workflow-model
dependency to the version 0.2.0
.
The LoopActivityEventHandler
can return void
or Promise
now.
This version adds a new feature to the break
activity. Now it is possible to break a parent loop without specifying the name of the loop. The previous approach is still supported.
createBreakActivity<BreakStep>('break', {
loopName: (step) => -1,
// ...
});
This version changes the syntax of all create*Activity
functions. The first argument is the step type, the second argument is the configuration.
// Old syntax
const fooActivity = createAtomActivity<FooStep, MyGlobalState, FooStateState>({
stepType: 'foo',
init: /* ... */,
handler: /* ... */
});
// New syntax
const fooActivity = createAtomActivity<FooStep, MyGlobalState, FooStateState>('foo', {
init: /* ... */,
handler: /* ... */
});
Additionally this version introduces the createAtomActivityFromHandler
function. It allows to create an activity by very short syntax. This function creates an activity without the activity state.
const fooActivity = createAtomActivityFromHandler<FooStep, MyGlobalState>('foo', async (step, globalState) => {
// handler
});
Breaking Changes
The activity state initializer has one new argument. The order of arguments is not backward compatible. The first argument is a step, the second argument is a global state.
Added two new activities: LoopActivity
and BreakActivity
.
Changed bundle format of the sequential-workflow-machine
package to: UMD, ESM and CommonJS.
First release! 🎉