npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@honeybpm/hbpm

v0.6.0

Published

A simple business process management tool written for NodeJS

Downloads

33

Readme

HoneyBPM Logo

A BPM (Business Process Management) framework to run business processes in a consistent and reusable way.

npm (scoped) Build Status Coverage Status license

Installation

npm install @honeybpm/hbpm

HoneyBPM is a simple process runner to allow developers to create business process which are built with reusable components. They do this by defining a ProcessMap made up of various Steps. Each Step runs a small piece of code called a Vertex.

Getting Started

The goal of HoneyBPM is to allow developers to make business processes in a component-based and standardized way. They do this by defining a ProcessMap made up of various Steps. Each Step runs a piece of code called a Vertex.

Your First Process Map

Let's make our first process. One that calculates tax rate for a value.


// todo: Add a process map code

Vertex

A Vertex is the smallest piece of a HoneyBPM process. Vertices should be reusable across many processes. There are two types of vertices, VertexSync and VertexAsync.

Vertex Sync

VertexSync is a vertex which will run to completion, as opposed to VertexAsync which allows you escape the vertex in the midst of a process and return to it later.

Creation

To create a VertexSync pass a name, and run middleware into the constructor.

let SomeSyncVertex = new VertexSync({
    name: "VertexA",
    description: "This vertex doesn't do anything useful",
    run: function(data, context,next) {
        console.log("Ran SyncVertex");
        return next();
    }
});

Using in a Step

To use in a step, pass the vertex into the step constructor as the vertex.


let SomeStep = new Step({
    name: "SomeStepName",
    description: "Some description of this step",
    vertex: SomeSyncVertex
});

Vertex Async

A VertexAsync is a vertex which you are able to leave and then return to at some point in a process map.

Creation

To create a VertexSync pass a name, and run middleware into the constructor.

let SomeAsyncVertex = new VertexAsync({
    name: "VertexA",
    description: "This vertex doesn't do anything useful",
    runAsync: function(data, context, next) {
        console.log("The vertex runs this function when you are running a process, after next() is called the process will stop");
        return next();
    },
    continueAsync: function(data, context,next) {
        console.log("Then when the process is continued this function will run");
        return next();     
    }
});

Uses

VertexAsync is useful for in processes which required user intervention. For example, you could have a VertexAsync create a task for a user to complete and then continue the process after they complete it.

let TaskVertex = new VertexAsync({
    name: "TaskVertex", 
    description: "A vertex for a task",
    runAsync: function(data, context, next) {
        
        // some code to write a task to a database...
        
        // write the taskId to the processes data so you can use it when you continue the process
        data.taskId = task.id;
        
        return next();
    },
    continueAsync: function(data, context,next) {
      
        let taskId = data.taskId;
        
        // code to find and complete the task using the data passed into the process
        
        return next();        
    }
    
});

Using in a Step

To use in a step, pass the vertex into the step constructor as the vertex.


let SomeStep = new Step({
    name: "SomeStepName",
    description: "Some description of this step",
    vertex: SomeAsyncVertex
});

Steps

Creating

'use strict';
const hbpm = require('@honeybpm/hbpm');

const logStep = new hbpm.Step({
    name: "LogStep",
    inputMapping: function (processData, done) {
        let inputData = {};
        inputData.title = "DDD";
        inputData.user = "Test";
        return done(null, inputData);
    },
    outputMapping: function (processData, stepData, done) {
        processData.a = "A";
        return done();
    },
    vertex: LogVertex
});

inputMapping

inputMapping: function(processData, done) inputMapping is a function which has processData and a done callback. You pass the data you want the vertex to the done callback as the second parameter (the first is an error).

outputMapping

outputMapping: function(processData, stepData, done)

outputMapping is a function which has processData, stepData, and a done callback. You don't need to pass anything to done.

Process Map

A process map is the structure of a business process and made up of various steps linked together with a to function which declares which step to run next.

Defining a Process Map