@statebacked/machine
v0.6.3
Published
Useful types and utilities for defining StateBacked.dev machine definitions for the State Backed XState backend as a service
Downloads
11
Maintainers
Readme
@statebacked/machine - State Backed machine definition types and runtime utilities
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 providedauthContext
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 providedauthContext
should be allowed to writeevent
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.