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

@bazariodev/fsm-inspect

v1.0.0

Published

Dev-time inspection helpers for @bazariodev/fsm timelines and Mermaid diagrams.

Downloads

20

Readme

@bazariodev/fsm-inspect

Dev-time inspection helpers for the Bazario FSM family.

@bazariodev/fsm-inspect is opt-in and side-effect free. It gives you:

  • a bounded InspectRecorder timeline
  • config instrumentation for init, transition-start, and transition entries
  • a logger adapter that records debug / warn / error diagnostics
  • recordSource for subscribe-based commit timelines
  • Mermaid stateDiagram-v2 export for flat and hierarchy configs

Timeline

import { Fsm } from '@bazariodev/fsm';
import { FsmEffects } from '@bazariodev/fsm-effects';
import {
  InspectRecorder,
  instrumentFsmConfig,
  recordSource,
} from '@bazariodev/fsm-inspect';

const recorder = new InspectRecorder({
  limit: 1000,
  mapContext: redactContext,
  mapEvent: redactEvent,
  mapSnapshot: redactSnapshot,
  mapMeta: redactLogMeta,
  onEntry: (entry) => console.debug(entry),
});

const machine = new Fsm(
  instrumentFsmConfig({ ...callConfig, logger: recorder.logger }, recorder),
);

const effects = new FsmEffects(machine, {
  ...callEffects,
  logger: recorder.logger,
});

const commits = recordSource(machine, recorder, { name: 'call' });

machine.send({ type: 'DIAL', destination: '101' });

console.table(recorder.entries);
commits.stop();
effects.stop();

instrumentFsmConfig is a pure transform. It returns a new config object and never mutates the input. Apply it before constructing the machine.

Transitions are traced as a start/complete pair:

  • transition-start is recorded from onTransitionStart
  • transition is recorded from onTransitionBeforeCommit
  • both entries share a recorder-allocated attemptId

If an accepted transition aborts before onTransitionBeforeCommit, the timeline contains only transition-start. If the consumer's own onTransitionBeforeCommit throws after the inspector records, both entries remain even though the commit aborts.

Source Recording

recordSource(source, recorder, options) works with anything exposing:

import type { FsmSubscribable } from '@bazariodev/fsm';

The shared core shape is a stable snapshot accessor plus subscribe(listener), where the listener may receive the committed snapshot.

It records the attach-time snapshot, then one commit entry per delivered snapshot. If a source delivers no subscriber payload, recordSource falls back to reading source.snapshot. Payload-delivered and fallback snapshots are deduped by reference, so hierarchy node birth snapshots are recorded once.

Commit labels are derived from the mapped snapshot, so mapSnapshot redaction applies before the default value / path label or a custom label callback runs.

Mermaid

import { mermaidFromFsmConfig } from '@bazariodev/fsm-inspect';

const diagram = mermaidFromFsmConfig(callConfig);

The renderers generate stateDiagram-v2 text from validated configs. Wildcard transitions render as notes by default:

mermaidFromFsmConfig(callConfig, { wildcard: 'note' });

Use wildcard: 'expand' to draw wildcard transitions from every state instead.

Hierarchy diagrams path-scope every Mermaid id so repeated state names in nested machines do not collide.

Redaction

Inspection retains contexts, snapshots, events, and log metadata in memory by reference. If a recorder forwards entries to a remote sink, redact all capture paths:

  • mapContext
  • mapSnapshot
  • mapEvent
  • mapMeta

Keeping credentials, tokens, and PII out of machine context and event payloads is still the better default.