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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@processengine/semantics

v2.0.0

Published

Flow 5 process semantics for ProcessEngine. Validates, prepares and executes Flow 5 DSL: PROCESS/DATA, CONTROL/ROUTE, EFFECT, WAIT, TERMINAL.

Readme

@processengine/semantics

Flow 5 process semantics for ProcessEngine.

Validates, prepares and executes flow definitions. Manages process state transitions according to the Flow 5 model.

Flow 5 model

PROCESS/DATA  — synchronous data processing via dataflow artifact
CONTROL/ROUTE — routing by any scalar value from state
EFFECT        — external async call (COMMAND, CALL, SUBFLOW)
WAIT/MESSAGE  — waiting for async response
TERMINAL      — COMPLETE or FAIL

Removed from Flow 5: PROCESS/RULES, PROCESS/MAPPINGS, PROCESS/DECISIONS, CONTROL/SWITCH.

Install

npm install @processengine/semantics

Quick start

import { validateFlow, prepareFlow, createProcessState, plan, reduce } from '@processengine/semantics';

const flowDef = {
  id: 'flow.example',
  version: '1.0.0',
  title: 'Example flow',
  description: 'Minimal Flow 5 process.',
  entryStepId: 'evaluate',
  steps: {
    evaluate: {
      id: 'evaluate', type: 'PROCESS', subtype: 'DATA',
      title: 'Evaluate', description: 'Runs a dataflow artifact.',
      artefactId: 'dataflow.example.evaluate',
      nextStepId: 'finish',
    },
    finish: {
      id: 'finish', type: 'TERMINAL', subtype: 'COMPLETE',
      title: 'Finish', description: 'Process complete.',
      result: { status: 'COMPLETE', outcome: 'DONE' },
    },
  },
};

// 1. Validate
const v = validateFlow(flowDef);
if (!v.ok) throw new Error(JSON.stringify(v.issues));

// 2. Prepare once
const flow = prepareFlow(flowDef);

// 3. Create process state
const state = createProcessState({ flow, processId: 'proc-001', input: { x: 1 } });
// state.context.data.{facts,decisions,checks,payloads,results} are all available

// 4. Orchestrator loop
const dataStep = plan(flow, state);
// dataStep.artefactId → pass to @processengine/dataflows
// dataStep contains NO input — orchestrator does not know about dataflow internals

const nextState = reduce(dataStep, state, {
  // DataflowOutput from @processengine/dataflows
  writes: [
    { ref: '$.context.data.decisions.x', value: { outcome: 'DONE' }, itemId: 'decide' },
  ],
});
// nextState.currentStepId === 'finish', status === 'COMPLETE'

Orchestrator contract

orchestrator:
  step = plan(flow, state)           // get current step description
  output = executeStep(step, state)  // call appropriate runtime (dataflows, etc.)
  state = reduce(step, state, output)// apply output, advance to next step
  persist(state)

ProcessContext

context.input             — process input
context.data.payloads.*   — intermediate payloads
context.data.facts.*      — decision-ready facts
context.data.decisions.*  — decision outcomes
context.data.checks.*     — rule check results
context.data.results.*    — terminal results (read by TERMINAL.resultRef)
context.effects.*         — effect responses

CONTROL/ROUTE

ROUTE reads a scalar from state by ref path:

  • String/number/boolean/null: matched against cases keys
  • Missing ref: runtime error FLOW_ROUTE_REF_NOT_RESOLVED (missing ref is a broken dataflow contract, not a business "no match")
  • Object/array: runtime error FLOW_ROUTE_REF_NOT_SCALAR
  • No matching case: defaultNextStepId

TERMINAL.resultRef

Must point into $.context.data.results.*. Written there by a PROCESS/DATA step before the terminal transition.

See also

  • @processengine/dataflows — executes dataflow artifacts for PROCESS/DATA steps
  • examples/ — canonical Flow 5 flow examples