@moostjs/event-wf
v0.6.27
Published
@moostjs/event-wf
Downloads
3,378
Maintainers
Readme
@moostjs/event-wf
Workflow event adapter for Moost, wrapping @wooksjs/event-wf and @prostojs/wf. Define workflow steps and flows using decorators, with full access to Moost's dependency injection, interceptors, and pipes.
Installation
npm install @moostjs/event-wfQuick Start
import { MoostWf, Step, Workflow, WorkflowSchema, WorkflowParam } from '@moostjs/event-wf'
import { Controller, Moost } from 'moost'
@Controller()
class MyWorkflows {
@Step('greet')
greet(
@WorkflowParam('context') ctx: { greeting: string },
@WorkflowParam('input') input?: string,
) {
ctx.greeting = `Hello, ${input}!`
}
@Workflow('my-flow')
@WorkflowSchema(['greet'])
myFlow() {}
}
const app = new Moost()
const wf = new MoostWf()
app.adapter(wf)
app.registerControllers(MyWorkflows)
await app.init()
// Start a workflow
const result = await wf.start('my-flow', { greeting: '' }, { input: 'World' })
console.log(result.state.context.greeting) // 'Hello, World!'AI Agent Skill
Install the unified Moost skill for AI coding agents (Claude Code, Cursor, etc.):
npx skills add moostjs/moostjsOfficial Documentation
License
MIT
