flowed
Version:
A fast and reliable flow engine for orchestration and more uses in *Node.js*, *Deno* and the browser
40 lines • 1.41 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FlowRunning = void 0;
const _1 = require(".");
const types_1 = require("../../types");
class FlowRunning extends _1.FlowState {
getStateCode() {
return types_1.FlowStateEnum.Running;
}
pause() {
this.setState(types_1.FlowStateEnum.Pausing);
return this.runStatus.finishPromise;
}
stop() {
this.setState(types_1.FlowStateEnum.Stopping);
return this.runStatus.finishPromise;
}
finished(error = false) {
this.setState(types_1.FlowStateEnum.Finished);
if (error) {
this.log({ n: this.runStatus.id, m: 'Flow finished with error. Results: %O', mp: this.getResults(), l: 'e', e: 'FF' });
this.execFinishReject(error);
}
else {
this.log({ n: this.runStatus.id, m: 'Flow finished with results: %O', mp: this.getResults(), e: 'FF' });
this.execFinishResolve();
}
}
postProcessFinished(error, stopFlowExecutionOnError) {
const stopExecution = error && stopFlowExecutionOnError;
if (!stopExecution) {
this.runStatus.state.startReadyTasks();
}
if (!this.runStatus.state.isRunning()) {
this.runStatus.state.finished(error);
}
}
}
exports.FlowRunning = FlowRunning;
//# sourceMappingURL=flow-running.js.map