@statebacked/machine

@statebacked/machine - State Backed machine definition types and runtime utilities

GitHub license npm version CI Docs

The types and utilities exported by this package are useful in defining State Backed machine definitions.

Installation

NPM

npm install --save @statebacked/machine

Yarn

yarn add @statebacked/machine

Deno

import type { AllowRead, AllowWrite } from "https://deno.land/x/statebacked_machine/mod.ts";

Overview

A State Backed machine definition consists of a javascript file that exports the following:

  • Default export an XState state machine (e.g. export default createMachine(...))
  • Export an allowRead function that accepts an object containing { machineInstanceName, state, context, authContext } and returns a boolean indicating whether an entity with the provided authContext should be allowed to read an instance of the machine having the provided name, state, and context.
  • Export an allowWrite function that accepts an object containing { machineInstanceName, state, context, event, authContext } and returns a boolean indicating whether an entity with the provided authContext should be allowed to write event to an instance of the machine having the provided name, state, and context.

This module provides types and utilities for these functions.

State Backed

State Backed allows you to spin up a backend by writing only an XState state machine.

Check out our docs and get started with the smply CLI. You can have a state machine backend running in 5 minutes.

License

@statebacked/machine is MIT licensed.

Generated using TypeDoc