open-index/open-npm huggingface dataset:
npm package: @ipheion/moulding-tin
Description: Easy type serialisation
Latest version: 0.0.1

# Moulding Tin

A simple tool to declare and serialise structs using Deno.

Simply:

```TypeScript
import {
  Read,
  Write,
  Struct,
  ASCII,
  Long,
  Serialised
} from "https://deno.land/x/moulding_tin@LATEST/mod";

const DataType = new Struct({
  a_string: new ASCII(),
  a_big_integer: new Long(),
});

App.onGotData((data: Buffer) => {
  const deserialised = Read(DataType, data);

  // Do something with your data
});

export function SendData(data: Serialised<T>) {
  const buffer = Write(DataType, data);

  // Do something with your buffer
}
```

## Why is this useful?

JSON is pretty large. This library can store an 8 boolean object in one number. This is good for passing data around micro services, storing data on the disk, and many other things of this nature.

## What are the down sides?

You must have a rigid contract. If not then the data will not be readable.
npm package: @ipheion/puristee
Description: Easy type serialisation
Latest version: 0.0.1

# Puristee

This is a tool designed to make stateful and pure server code. It supports return JSON or JSX to make rest or HTML servers.

## The key concepts

### Handlers

Handlers are provided to handle requests. They should be completely pure.

### State

This is the main focus of this library. The state should be a type that is declared when creating a server. This is then provided for each request in a readonly fashion and a partial of it should be returned at the end processing.

## Examples

``` TypeScript
import CreateServer, { Provider, PureRequest, Readify } from "https://deno.land/x/puristee@VERSION/mod.ts";

type State = {
  data: string;
}

// Loaded on first setup
const InitialState: State = { data: "hello" };

// The state can be accessed directly in the handler but common functions can be added here
class StateProvider extends Provider<State> {
  public get Hello() {
    return this.State.data;
  }
}

const Server = CreateServer("./data", InitialState, StateProvider);

// Type anotations are not required
Server.CreateHandler("/hello", "GET")
  .Register(
    (request: PureRequest, s: Readify<State>, p: StateProvider, c: unknown) => {
      return {
        response: { status: 200, body: { message: s.data } }
      };
    }
  );

Server.CreateHandler("/hello", "PUT")
  .Register(
    (request: PureRequest, s: Readify<State>, p: StateProvider, c: unknown) => {
      return {
        response: { status: 200, body: { message: s.data } },
        state: { data: "world" }
      };
    }
  );
```