@statebacked/machine
TypeScript icon, indicating that this package has built-in type declarations

0.6.3 • Public • Published

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

Package Sidebar

Install

npm i @statebacked/machine

Weekly Downloads

3

Version

0.6.3

License

MIT

Unpacked Size

47.9 kB

Total Files

15

Last publish

Collaborators

  • abrgr