JavaScript-based workflow engine