@deliverr/serverless-offline-step-functions
Version:
Serverless Offline Plugin to Support Step Functions for Local Development
52 lines (51 loc) • 1.55 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ContextToJson = void 0;
const ContextToJson = (context) => {
return {
Task: TaskContextToJson(context.Task),
Map: MapContextToJson(context.Map),
Execution: ExecutionContextToJson(context.Execution),
State: StateContextToJson(context.State),
StateMachine: StateMachineContextToJson(context.StateMachine),
};
};
exports.ContextToJson = ContextToJson;
const TaskContextToJson = (taskContext) => {
return {
Token: taskContext.Token,
};
};
const MapContextToJson = (mapContext) => {
if (!mapContext) {
return;
}
return {
Item: {
Index: mapContext === null || mapContext === void 0 ? void 0 : mapContext.Item.Index,
Value: mapContext === null || mapContext === void 0 ? void 0 : mapContext.Item.Value,
},
};
};
const ExecutionContextToJson = (executionContext) => {
return {
Id: executionContext.Id,
Input: executionContext.Input,
Name: executionContext.Name,
RoleArn: executionContext.RoleArn,
StartTime: executionContext.StartTime,
};
};
const StateContextToJson = (stateContext) => {
return {
EnteredTime: stateContext.EnteredTime,
Name: stateContext.Name,
RetryCount: stateContext.RetryCount,
};
};
const StateMachineContextToJson = (stateMachineContext) => {
return {
Id: stateMachineContext.Id,
Name: stateMachineContext.Name,
};
};