GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - sammarks/workflow: A node package for executing simple workflows with rollback support.

BranchesTags
Open more actions menu

Latest commit

 

History

21 Commits
21 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
src
src
 
 
test
test
 
 
tools
tools
 
 
.editorconfig
.editorconfig
 
 
.gitignore
.gitignore
 
 
.nojekyll
.nojekyll
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
code-of-conduct.md
code-of-conduct.md
 
 
jest.config.js
jest.config.js
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
rollup.config.ts
rollup.config.ts
 
 
tsconfig.json
tsconfig.json
 
 
tslint.json
tslint.json
 
 

Repository files navigation

styled with prettier GitHub Workflow Status Coveralls Dev Dependencies Donate

workflow is a Node JS library designed to facilitate the execution of simple workflows with rollback support. This allows you to take small units of code and combine them together into a larger workflow to accomplish a single large task.

See the documentation for more details.

Get Started

npm install @sammarks/workflow
yarn add @sammarks/workflow
import { execute } from '@sammarks/workflow'

interface WorkflowContext {
  firstStepRun: boolean
  secondStepRun: boolean
  test: string
}

const workflow = [
  {
    name: 'first',
    run: async (context: WorkflowContext): Promise<void> => {
      context.firstStepRun = true
    },
    revert: async (context: WorkflowContext): Promise<void> => {
      context.firstStepRun = false
    }
  },
  {
    name: 'second',
    run: async (context: WorkflowContext): Promise<void> => {
      context.secondStepRun = true
    },
    revert: async (context: WorkflowContext): Promise<void> => {
      context.secondStepRun = false
    }
  }
]

const result = await execute<WorkflowContext>('test-workflow', workflow, { test: 'foo' })
console.log(result)

// {
//   firstStepRun: true,
//   secondStepRun: true,
//   test: 'foo'
// }

Features

  • Define steps in a simple, typed, array-object format.
  • Steps and workflows are given names for debugging support.
  • Rollback support in case a step fails.
  • Predictable and documented error handling in case something goes wrong.

Why use this?

Breaking the large task into smaller units of code allows a less complicated end result, and greater unit testing abilities since each step in the workflow is broken into its own function.

Rollback support allows a transactional nature for executing workflows. If one step in the process fails to execute, all previously-executed steps with a configured rollback are executed.

workflow provides TypeScript hinting and a predictable error interface to handle issues when they arise.

About

A node package for executing simple workflows with rollback support.

sammarks.github.io/workflow/

Topics

noderollback-supportstepstep-functionstypescriptworkflows

Resources

Readme
MIT license

Code of conduct

Code of conduct

Contributing

Contributing
Activity

Stars

1 star

Watchers

0 watching

Forks

2 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.