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

log-view-machine

v1.4.1

Published

A powerful state machine library with fluent API, sub-machines, RobotCopy message broker, GraphQL integration, structural system for application organization, and native routed send with relative path support

Downloads

16

Readme

Log View Machine

A powerful state machine library with fluent API, sub-machines, RobotCopy message broker, and GraphQL integration.

Project Structure

log-view-machine/
├── log-view-machine/          # Core library code
│   ├── src/                  # Source code
│   ├── dist/                 # Built distribution
│   ├── core/                 # Core state machine logic
│   ├── graphql/              # GraphQL integration
│   ├── adapters/             # Adapter implementations
│   └── package.json          # Library package configuration
├── example/                  # Example applications
│   ├── ts-example/           # TypeScript/React example
│   ├── kotlin-example/       # Kotlin example
│   ├── java-example/         # Java example
│   └── node-example/         # Node.js example
├── docs/                     # Documentation
├── scripts/                  # Build and development scripts
└── package.json              # Workspace configuration

Features

  • Fluent API: Beautiful withState() syntax for state management
  • Sub-Machines: Compose complex state machines from simpler ones
  • RobotCopy Message Broker: Configurable message broker with multiple transport options
  • GraphQL Integration: Built-in GraphQL server and client generation
  • Multi-Language Support: Examples in TypeScript, Kotlin, Java, and Node.js
  • Client Generation: Automated client discovery and code generation

Getting Started

Prerequisites

  • Node.js 18+
  • npm or yarn
  • Java 11+ (for Java/Kotlin examples)
  • Docker (for some examples)

Installation

# Clone the repository
git clone https://github.com/viewstatemachine/log-view-machine.git
cd log-view-machine

# Install dependencies
npm install

# Build the library
npm run build

Development

# Start development mode
npm run dev

# Run tests
npm run test

Library Usage

The core library is located in log-view-machine/ and provides:

Basic State Machine

import { createViewStateMachine } from 'log-view-machine';

const machine = createViewStateMachine({
  machineId: 'my-machine',
  xstateConfig: {
    initial: 'idle',
    states: {
      idle: { on: { START: 'active' } },
      active: { on: { STOP: 'idle' } }
    }
  }
})
.withState('idle', async ({ log, view, send }) => {
  await log('Entered idle state');
  return view(<div>Idle UI</div>);
})
.withState('active', async ({ log, view, send }) => {
  await log('Entered active state');
  return view(<div>Active UI</div>);
});

Sub-Machines

.withState('selecting', async ({ getSubMachine, view }) => {
  const childMachine = getSubMachine('child');
  return view(childMachine.render(model));
});

RobotCopy Message Broker

import { createRobotCopy } from 'log-view-machine';

const robotCopy = createRobotCopy();
robotCopy.registerMachine('my-machine', machine, {
  messageBrokers: [
    { type: 'window-intercom', config: { targetOrigin: '*' } },
    { type: 'http-api', config: { baseUrl: 'https://api.com' } },
    { type: 'graphql', config: { endpoint: 'https://api.com/graphql' } }
  ]
});

Client Generation

import { createClientGenerator } from 'log-view-machine';

const clientGenerator = createClientGenerator();
clientGenerator.registerMachine('my-machine', machine, {
  description: 'My awesome machine',
  version: '1.0.0'
});
const typescriptClient = clientGenerator.generateClientCode('typescript', 'my-machine');

Examples

TypeScript/React Example (example/ts-example/)

A comprehensive React application demonstrating:

  • Traditional XState implementation
  • Fluent API usage
  • Advanced features with sub-machines and RobotCopy
cd example/ts-example
npm install
npm run dev

Kotlin Example (example/kotlin-example/)

Kotlin implementation showing:

  • State machine creation
  • HTTP client integration
  • GraphQL adapter usage
cd example/kotlin-example
./gradlew build

Java Example (example/java-example/)

Java implementation demonstrating:

  • State machine analysis
  • GraphQL integration
  • Multi-language interoperability
cd example/java-example
./gradlew build

Node.js Example (example/node-example/)

Node.js implementation featuring:

  • State analyzer
  • OpenTelemetry integration
  • Docker deployment
cd example/node-example
npm install
docker-compose up

Architecture

Core Components

  • ViewStateMachine: Main state machine with fluent API
  • RobotCopy: Message broker with multiple transport options
  • ClientGenerator: Automated client code generation
  • GraphQL Server: Built-in GraphQL server for state machine queries

Message Brokers

  • Window Intercom: Cross-window communication
  • HTTP API: RESTful API integration
  • GraphQL: GraphQL endpoint integration
  • WebSocket: Real-time communication

Client Generation

Supports multiple languages:

  • TypeScript/JavaScript
  • Kotlin
  • Java
  • Python (planned)

Development

Adding New Examples

  1. Create a new directory in example/
  2. Set up the appropriate build system (npm, gradle, etc.)
  3. Import from the library: import { createViewStateMachine } from 'log-view-machine'
  4. Add documentation in the example's README

Modifying the Library

  1. Make changes in log-view-machine/src/
  2. Build the library: npm run build
  3. Examples will automatically use the updated library

Testing

# Run all tests
npm test

# Run specific example tests
cd example/ts-example && npm test

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Submit a pull request

License

MIT License - see LICENSE file for details.

Documentation

Support