in saga/seata-saga-statemachine-designer/src/modeling/SagaExporter.js [42:89]
SagaExporter.prototype.parseEdge = function (definitions, edge) {
const { businessObject } = edge;
const elementJson = businessObject.exportJson();
const { source, target } = elementJson.style;
if (!source) {
if (definitions.StartState) {
throw new Error(`Two or more start states, ${target} and ${definitions.StartState}`);
} else {
definitions.StartState = target;
if (definitions.edge === undefined) {
definitions.edge = {};
}
assign(definitions.edge, elementJson);
}
} else {
const stateRef = definitions.States[source];
switch (businessObject.Type) {
case 'ChoiceEntry':
if (!stateRef.Choices) {
stateRef.Choices = [];
}
stateRef.Choices.push({
Expression: businessObject.Expression,
Next: target,
});
if (businessObject.Default) {
stateRef.Default = target;
}
stateRef.edge = assign(stateRef.edge || {}, { [target]: elementJson });
break;
case 'ExceptionMatch':
stateRef.Catch.push({
Exceptions: businessObject.Exceptions,
Next: target,
});
stateRef.catch = assign(stateRef.catch || {}, { edge: { [target]: elementJson } });
break;
case 'Compensation':
stateRef.CompensateState = target;
stateRef.edge = assign(stateRef.edge || {}, { [target]: elementJson });
break;
case 'Transition':
default:
stateRef.Next = target;
stateRef.edge = assign(stateRef.edge || {}, { [target]: elementJson });
}
}
};