@wooksjs/event-wf
TypeScript icon, indicating that this package has built-in type declarations

0.4.35 • Public • Published

@wooksjs/event-wf

!!! This is work-in-progress library, breaking changes are expected !!!


The @wooksjs/event-wf is a component of the wooks event processing framework built on top of @prostojs/wf. It provides a way to manage complex workflows and processes using the underlying workflow engine.

The primary features of @wooksjs/event-wf include:

  • Support for conditional workflow branching based on dynamic conditions.
  • Support for parametric steps and workflows.
  • Support for user input requirements and interaction during the workflows.

Installation

To install @wooksjs/event-wf, you can use npm:

npm install wooks @wooksjs/event-wf

Quick Start

import { useRouteParams } from '@wooksjs/event-core'
import { createWfApp } from '@wooksjs/event-wf'

const app = createWfApp<{ result: number }>()

app.step('add', {
    input: 'number',
    handler: 'ctx.result += input',
})

app.step('add/:n', {
    handler: (ctx) => {
        ctx.result += Number(useRouteParams().get('n'))
    },
})

app.flow('adding', [
    { id: 'add', input: 5 },
    { id: 'add', input: 2 },
    {
        condition: 'result < 10',
        steps: [{ id: 'add', input: 3 }, { id: 'add', input: 4 }],
    },
])

app.flow('adding-parametric', [
    'add/5',
    'add/2',
    {
        condition: 'result < 10',
        steps: ['add/3', 'add/4'],
    },
])

app.run()

// Run the 'adding' workflow
app.start('adding', { result: 0 })

Documentation

For more detailed documentation, please visit wooks.moost.org.

Contributing

Contributions to the @wooksjs/event-wf project are welcome. If you find any bugs or have a feature request, please open an issue on the GitHub repository.

License

@wooksjs/event-wf is licensed under the MIT license.

Package Sidebar

Install

npm i @wooksjs/event-wf

Weekly Downloads

3

Version

0.4.35

License

MIT

Unpacked Size

26 kB

Total Files

5

Last publish

Collaborators

  • mav-rik