@deliverr/serverless-offline-step-functions
Version:
Serverless Offline Plugin to Support Step Functions for Local Development
43 lines (42 loc) • 1.51 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Context = void 0;
const MapContext_1 = require("./MapContext");
const TaskContext_1 = require("./TaskContext");
class Context {
constructor(_executionContext, _stateMachineContext, _stateContext, _taskContext) {
this._executionContext = _executionContext;
this._stateMachineContext = _stateMachineContext;
this._stateContext = _stateContext;
this._taskContext = _taskContext;
}
static create(executionContext, stateMachineContext, stateContext, taskContext = TaskContext_1.TaskContext.create()) {
return new Context(executionContext, stateMachineContext, stateContext, taskContext);
}
get Execution() {
return this._executionContext;
}
get StateMachine() {
return this._stateMachineContext;
}
get State() {
return this._stateContext;
}
get Task() {
return this._taskContext;
}
get Map() {
return this._mapContex;
}
clone() {
return new Context(this._executionContext, this._stateMachineContext, this._stateContext, this._taskContext);
}
startMapItration(iterationIndex, iterationInputValue) {
this._mapContex = MapContext_1.MapContext.create(iterationIndex, iterationInputValue);
}
transitionTo(state, task = TaskContext_1.TaskContext.create()) {
this._stateContext = state;
this._taskContext = task;
}
}
exports.Context = Context;