open-index/open-npm huggingface dataset:
npm package: @12deg/billing-react
Description: Billing plugin for react
Latest version: 0.2.2

# @12deg/billing-react

Support billing for react app.

## Installation

Install with npm:

```bash
npm install @12deg/billing-react
```

Install with pnpm:

```bash
pnpm add --filter "@scope/project" @12deg/billing-react
```

## Usage
npm package: @12degrees/stateful-fastify
Description: A fastify plugin for the stateful library
Author: 12 Degrés SAS
Latest version: 0.4.1

# @12degrees/stateful/fastify

A fastify plugin for implementing a state machine.

## Requirements

A [fastify](https://fastify.dev) server.

## Installation

Install with npm:

```bash
npm install @12degrees/stateful-fastify
```

Install with pnpm:

```bash
pnpm add --filter "@scope/project" @12degrees/stateful-fastify
```

## Usage

### Register the stateful plugin in your fastify server instace

Register the plugin with your fastify instance:

```typescript
import plugin from "@12degrees/stateful-fastify";
import Fastify from "fastify";

const start = async () => {
  const fastify = await Fastify();

  // Register state-machine-fastify plugin
  await fastify.register(plugin, { ... });

  try {
    await fastify.listen({
      port: 3000,
      host: "0.0.0.0",
    });
  } catch (error) {
    fastify.log.error(error);
  }
};

start();
```

## Register the stateful plugin in your entity controller

```
# ThingController.ts
import statefulPlugin from "@12degrees/stateful-fastify";
...

const plugin = async (
  fastify: FastifyInstance,
  options: Records<string, any>
) => {
  ...

  fastify.get("/things, {
    ...
  });

  fastify.post("/things/:id", {
    ...
  });

  // Register stateful plugin
  await fastify.register(
    StatefulPlugin,
    {
      prefix: ...,
      entity: {
        dropTables: true,
        field: "status",
        name: "thing",
        table: "things",
        users: "users",
      },
    }
  );
}
```

## Options

The Stateful plugin suports the standard [Fastify plugin](https://fastify.dev/docs/latest/Reference/Plugins/) options:

  * `logLevel`
  * `logSerializers`
  * `prefix`

An additional `entity: StatefulPluginOptions` option is requred: 


| Option     | Type    | Required | Default  | Description |
|------------|---------|----------|----------|-------------|
| dropTables | boolean | no       | false    | Whether to drop all generated tables before running migrations. |
| field      | string  | yes      | `status` | The name of the attribute representing the state in the entity concerned. |
| name       | string  | yes      |          | The name of the entity for which to create a state machine. Will be used as the prefix of all generated tables. |
| table      | string  | yes      |          | The name of the table for the  entities in question. |
| users      | string  | no       | `users`  | The name of the table containing user records. |