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

v3.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.

The package validates Flow 5 artifacts, prepares them for runtime, and applies lifecycle transitions over State v2.

Flow 5 Model

PROCESS/DATA  -> synchronous data assessment through @processengine/dataflows
CONTROL/ROUTE -> routing by a scalar from $.data.*
EFFECT        -> external COMMAND/SUBFLOW async lifecycle or synchronous CALL
WAIT/MESSAGE  -> wait for an EFFECT result
TERMINAL      -> COMPLETE or FAIL

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

CALL is synchronous: it must complete in apply(...) and must not transition to WAIT/MESSAGE. Use COMMAND or SUBFLOW for asynchronous external lifecycle.

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: 'route',
    },
    route: {
      id: 'route',
      type: 'CONTROL',
      subtype: 'ROUTE',
      title: 'Route',
      description: 'Routes by dataflow decision.',
      ref: '$.data.decisions.x.outcome',
      cases: { DONE: 'finish' },
      defaultNextStepId: 'finish',
    },
    finish: {
      id: 'finish',
      type: 'TERMINAL',
      subtype: 'COMPLETE',
      title: 'Finish',
      description: 'Process complete.',
      resultRef: '$.data.results.done',
    },
  },
};

const validation = validateFlow(flowDef);
if (!validation.ok) throw new Error(JSON.stringify(validation.issues));

const flow = prepareFlow(flowDef);
let state = createProcessState({ flow, processId: 'proc-001', input: { x: 1 } });

const dataStep = plan(flow, state);
state = reduce(dataStep, state, {
  writes: [
    { ref: '$.data.decisions.x', value: { outcome: 'DONE' }, itemId: 'decide' },
    { ref: '$.data.results.done', value: { status: 'COMPLETE', outcome: 'DONE' }, itemId: 'result' },
  ],
});

const routeStep = plan(flow, state);
state = reduce(routeStep, state, null);

State v2 Shape

state.input             -> process input
state.data.payloads.*   -> intermediate payloads
state.data.facts.*      -> decision-ready facts
state.data.decisions.*  -> decision outcomes
state.data.checks.*     -> rule check results
state.data.results.*    -> terminal results
state.steps.*           -> step execution records
state.timeline[]        -> minimal execution timeline

There is no persisted context, history, context.effects, or runtime waitResult projection in State v2. Domain payload fields named waitResult inside input or data are allowed. Even with trace: 'off', PROCESS/DATA write values stay in dataflow.writes[] as the audit projection.

EFFECT / WAIT Results

EFFECT executions are stored under state.steps.<effectStepId>.executions[].

The virtual path segment latest resolves through latestExecutionId:

$.steps.send_client.latest.command.result
$.steps.run_child.latest.subflow.result

Only the first PROCESS/DATA after a WAIT/MESSAGE should read these paths. That bridge DATA step normalizes external response data into $.data.*.

TERMINAL.resultRef

TERMINAL.resultRef must point into $.data.results.*.

See Also

  • SPEC.md and SPEC_RU.md for the normative contract.
  • @processengine/dataflows for PROCESS/DATA execution.
  • examples/ for canonical Flow 5 artifacts.