diff --git a/src/workflow/StatedWorkflow.js b/src/workflow/StatedWorkflow.js index aaf519d..9aa1d91 100644 --- a/src/workflow/StatedWorkflow.js +++ b/src/workflow/StatedWorkflow.js @@ -59,7 +59,7 @@ export class StatedWorkflow { "publish": this.publish.bind(this), "recover": this.recover.bind(this), "logFunctionInvocation": this.logFunctionInvocation.bind(this), - //"workflow": StatedWorkflow.workflow.bind(this) + "workflow": this.workflow.bind(this) } }; this.templateProcessor = new TemplateProcessor(template, context); diff --git a/stated-workflow.js b/stated-workflow.js index 972413c..702e657 100755 --- a/stated-workflow.js +++ b/stated-workflow.js @@ -6,10 +6,13 @@ import {WorkflowDispatcher} from "./src/workflow/WorkflowDispatcher.js"; (async () => { //starts a single-user REPL session in its own dedicated process therefore replacing //the static DEFAULT_FUNCTIONS won't have side effects - const {templateProcessor:tp} = await StatedWorkflow.newWorkflow() + const statedWorkflow = await StatedWorkflow.newWorkflow() + const {templateProcessor:tp} = statedWorkflow; const repl = new StatedREPL(tp); // FIXME: This is a workaround and probably should better be set in StatedWorkflow.newWorkflow() - repl.cliCore.onInit = WorkflowDispatcher.clear; + + statedWorkflow.workflowDispatcher = new WorkflowDispatcher({}); + repl.cliCore.onInit = statedWorkflow.workflowDispatcher.clear; // TODO: stop the subscriber // TODO: await repl.initialize();