Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alex20465/flowbject
Flowbject is a library that allows you to describe state machines with objects.
https://github.com/alex20465/flowbject
Last synced: about 2 months ago
JSON representation
Flowbject is a library that allows you to describe state machines with objects.
- Host: GitHub
- URL: https://github.com/alex20465/flowbject
- Owner: alex20465
- License: mit
- Archived: true
- Created: 2018-02-18T19:24:39.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-09-29T12:51:21.000Z (about 5 years ago)
- Last Synced: 2024-09-03T05:50:59.377Z (2 months ago)
- Language: TypeScript
- Homepage:
- Size: 98.6 KB
- Stars: 13
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-serverless - flowbject - A high-level library whose aim is to help with writing state-machine flows. (Frameworks)
README
# Flowbject
[![Build Status](https://travis-ci.org/alex20465/flowbject.svg?branch=master)](https://travis-ci.org/alex20465/flowbject)
[![npm version](https://badge.fury.io/js/flowbject.svg)](https://www.npmjs.com/package/flowbject)
Flowbject is a high-level library whose aim is to help with writing state-machine flows. The concept is based on [Amazon-State-Language](https://states-language.net/spec.html).
It provides a more convenient way to write and manipulate states. The state-machine JSON extraction is encapsulated in hydrators and allows the integration of multiple API languages such as AWS-StepFunctions.
## Installation
```bash
npm install flowbject
```## Usage
Here is an example how to build a state-machine and extract the language-specifications to AWS-StepFunctions.
```typescript
import { StateMachine, Pass, AWSStepFunctionsHydratorManager } from "flowbject";const stateMachine = new StateMachine({
autoLink: true,
comment: 'A Hello World example of the Amazon States Language using a Pass state'
});const helloWorld = (new Pass('HelloWorld')).result.set('Hello World!')
stateMachine.states.add(helloWorld);
const manager = new AWSStepFunctionsHydratorManager();
const result = manager.extractStateMachine(stateMachine);
```Results:
```json
{
"Comment": "A Hello Worldexample of the Amazon States Language using a Pass state",
"StartAt": "HelloWorld",
"States": {
"HelloWorld": {
"Result": "Hello World!",
"End": true,
"Type": "Pass"
}
}
}
```