| npm | @opoha/plugin-workflow |
| Repo | Opoha/plugin-workflow |
@opoha/plugin-workflow — multi-step workflow engine for Opoha Automation.
ADR-0003 / contract 0.1. Definitions and the step runner live in this plugin;
core provides the event bus (OrderPaid trigger) and jobs hooks for delay /
approval foundation stubs. Persistence uses TypeORM only (ADR-0010) with
plugin-owned tables (plugin_workflow_*).
| Token / API | Role |
|---|---|
workflow.ready |
Lifecycle readiness stub |
workflow.engine |
Definitions, runner, action registry, run list |
| Listener | OrderPaid → active workflows |
| GraphQL | workflowDefinitions, upsertWorkflowDefinition, workflowRuns |
Plugin authors register actions without core patches:
import { registerWorkflowAction } from '@opoha/plugin-workflow';
registerWorkflowAction('my-plugin.notify', async (ctx) => {
// ctx.data is the OrderPaid (or other) event payload DTO
console.log(ctx.aggregateId, ctx.params);
});Or via the host-bound provider token workflow.engine.registerAction.
import { ORDER_PAID_EVENT, upsertWorkflowDefinition } from '@opoha/plugin-workflow';
await upsertWorkflowDefinition({
code: 'fulfill-on-paid',
name: 'Fulfill on paid',
triggerEvent: ORDER_PAID_EVENT,
steps: [
{ type: 'action', action: 'my-plugin.notify', params: { channel: 'ops' } },
{ type: 'action', action: 'workflow.log' },
],
});import { entities, migrations, MIGRATIONS_TABLE_NAME } from '@opoha/plugin-workflow/database';Tables: plugin_workflow_definitions, plugin_workflow_runs.
Migrations table: opoha_migrations_workflow.
pnpm add @opoha/plugin-workflowAdd the package to your app opoha.config.json "plugins" array (or set OPOHA_PLUGINS / OPOHA_PLUGINS_PATH for a local checkout).
pnpm install && pnpm build
export OPOHA_PLUGINS="$(pwd)"Core discovers via OPOHA_PLUGINS / OPOHA_PLUGINS_PATH and dynamically
imports dist/index.js — core never statically imports this package.
pnpm install
pnpm build
pnpm testSee Opoha Automation docs for workflow host integration.
MIT © Opoha