An open API service indexing awesome lists of open source software.

https://github.com/perry-mitchell/fruition

Track execution paths and outcomes to form an explanation for understanding what happened
https://github.com/perry-mitchell/fruition

Last synced: 13 days ago
JSON representation

Track execution paths and outcomes to form an explanation for understanding what happened

Awesome Lists containing this project

README

          

# Fruition
> Track execution paths and outcomes to form an explanation for understanding what happened

## About

Fruition is a simple harness to record steps of execution by making "notes" (Nodes), which some of these being able to mark _branching_ or _measurements_. It outputs a handy string description so application flow debugging can be improved.

NodeJS v16 and up is supported. Types are provided.

## Usage

To get started, import the `Fruition` class:

```typescript
import { Fruition } from "fruition";

function someFlow(): [number, Fruition] {
const fruition = new Fruition("some-flow");
//
fruition.mark("db lookups");
//
if (true) {
fruition.branch("dev mode", {
dev: true,
code: 123
});
}
// Done
return [1, fruition];
}

// Later
const [result, trace] = someFlow();
console.log(trace.toString());
```

Flow can be improved by adding the `Realisation` class:

```typescript
import { Fruition, Realisation } from "fruition";

function someFlow(): Realisation {
const fruition = new Fruition("some-flow");
//
return new Realisation(1, fruition);
}

// Later
const realisation = someFlow();
console.log(trace.explain());

realisation.result // 1
realisation.trace // Fruition
```

_TBC_