open-index/open-npm huggingface dataset:
npm package: @matter-in-motion/app
Description: Generic App. Has settings. Loads extensions.
Author: Alexey Novikov
Latest version: 1.2.0

# Matter In Motion

[![NPM Version](https://img.shields.io/npm/v/@matter-in-motion/app.svg?style=flat-square)](https://www.npmjs.com/package/@matter-in-motion/app)
[![NPM Downloads](https://img.shields.io/npm/dt/@matter-in-motion/app.svg?style=flat-square)](https://www.npmjs.com/package/@matter-in-motion/app)

**Node.js framework for building applications (cli, server, etc...).**

## App

Genereic app class, the foundation of your application. It has only three functions:

1. Manage settings for different environments.
2. Load extensions
3. Events managment

### Installation

`npm i @matter-in-motion/app`

### Usage

1. [Getting started](https://github.com/matter-in-motion/app/blob/master/docs/getting-started.md) — explanations of framework's architecture and a tutorial with all the steps to make an application from scratch
2. Clone the [demo application](https://github.com/matter-in-motion/demo).

### Content

- [App](https://github.com/matter-in-motion/mm/blob/master/docs/app.md)
- [Settings](https://github.com/matter-in-motion/mm/blob/master/docs/settings.md)
- [Units](https://github.com/matter-in-motion/mm/blob/master/docs/units.md)
- Extensions

License: MIT.
npm package: @matter-in-motion/loggers.pino
Description: Matter in Motion Extension. Logger Pino
Author: Alexey Novikov
Latest version: 1.0.0

# Matter In Motion

[![NPM Version](https://img.shields.io/npm/v/@matter-in-motion/loggers.pino.svg?style=flat-square)](https://www.npmjs.com/package/@matter-in-motion/loggers.pino)
[![NPM Downloads](https://img.shields.io/npm/dt/@matter-in-motion/loggers.pino.svg?style=flat-square)](https://www.npmjs.com/package/@matter-in-motion/loggers.pino)

**Node.js framework for building applications (cli, server, etc...).**

## Pino

Matter In Motion extension for [pino](https://github.com/pinojs/pino) logger

### Installation

`npm i @matter-in-motion/loggers.pino`

### Settings

- pino
  - options
  - destination

Both settings are described [here](https://github.com/pinojs/pino/blob/master/docs/api.md)

### Usage

```js
const logger = app.require('loggers.pino').get('app');
```

#### get(unitName)

Return a child logger with added unit information

_All loggers units are required to have one method `get(unitName)` that returns an actual logger instance with `{ unit: unitName }` added to every message._

License: MIT.
npm package: @matter-in-motion/templates.nunjucks
Description: Matter in Motion Extension. Nunjucks templates
Author: Alexey Novikov
Latest version: 1.0.0

# Matter In Motion. Nunjucks templates

[![NPM Version](https://img.shields.io/npm/v/@matter-in-motion/templates.nunjucks.svg?style=flat-square)](https://www.npmjs.com/package/@matter-in-motion/templates.nunjucks)
[![NPM Downloads](https://img.shields.io/npm/dt/@matter-in-motion/templates.nunjucks.svg?style=flat-square)](https://www.npmjs.com/package/@matter-in-motion/templates.nunjucks)

**Node.js framework for building applications (cli, server, etc...).**

## Nunjucks

[Nunjucks templates](https://mozilla.github.io/nunjucks) extension for [matter in motion](https://github.com/matter-in-motion/mm) framework

### Installation

`npm i @matter-in-motion/templates.nunjucks`

## Usage

1. Add `templates.nunjucks` to your extensions in the settings.

```js
const env = app.require('templates.nunjucks');
env.renderString('Hello {{ name }}', { name: 'World' });
```

## Settings

Add `nunjucks` section to your settings with path to templates.

- **path** — string, path to where your templates live
- global — object, global variables to add to an environment context
- extensions — array of nunjucks extensions that would be added to nunjucks environment
- options - [nunjukcs options](https://mozilla.github.io/nunjucks/api.html#configure)

License: MIT.
npm package: @matter-in-motion/transport
Description: Matter in Motion Extension. Transport
Author: Alexey Novikov
Latest version: 1.0.0

# Matter In Motion

[![NPM Version](https://img.shields.io/npm/v/@matter-in-motion/transport.svg?style=flat-square)](https://www.npmjs.com/package/@matter-in-motion/transport)
[![NPM Downloads](https://img.shields.io/npm/dt/@matter-in-motion/transport.svg?style=flat-square)](https://www.npmjs.com/package/@matter-in-motion/transport)

**Node.js framework for building applications (cli, server, etc...).**

## Transport

Matter In Motion transport extension.

### Installation

`npm i @matter-in-motion/trasnport`

### Usage

1. Add it to your extensions in the settings.
1. Add at least one transport extension

```js
app.on('transport/http/get/user/:id', (msg, params) =>
  console.log('user', params.id)
);
```

### Transports

You can add other transports:

- [http](https://github.com/matter-in-motion/transports.http)
- [websockets](https://github.com/matter-in-motion/transports.websockets) - wip

All transports will start with application `await app.start()`

### Methods

#### send(message)

Sends the response set for the message. For the message structure look into individual transport extension documentation.

### Hooks

There are [async hooks](https://www.npmjs.com/package/async-hooks) available for `emit`, `send`, `start`, and `stop` methods.

### Settings

No settings

License: MIT.
npm package: @matter-in-motion/transports.http
Description: Matter in Motion Extension. HTTP Transport
Author: Alexey Novikov
Latest version: 1.0.0

# Matter In Motion

[![NPM Version](https://img.shields.io/npm/v/@matter-in-motion/transports.http.svg?style=flat-square)](https://www.npmjs.com/package/@matter-in-motion/transports.http)
[![NPM Downloads](https://img.shields.io/npm/dt/@matter-in-motion/transports.http.svg?style=flat-square)](https://www.npmjs.com/package/@matter-in-motion/transports.http)

**Node.js framework for building applications (cli, server, etc...).**

## HTTP Transport

Matter In Motion transport extension for HTTP/S protocol.

### Installation

- `npm i @matter-in-motion/trasnport`
- `npm i @matter-in-motion/trasnports.http`

### Usage

1. Add it to your extensions in the settings.
2. Add settings

### Message

Message is simple object that get passed through app. By coming out of this transport it has this properties:

- **url** - instance of the URL class
- **decodeBy** - mime, `Content-Type` header
- **encodeBy** - mime, `Accept` header
- **requestHeaders** - http request headers with parsed cookies if avaliable
- **requestMethod** - http request method
- **request** - body of the request
- **connection** – http response

### Response

To sent response you can set following properties and use `transport.send` method.

- **response** – `undefined`, `null`, `string`, `Buffer`, or `stream`
- responseStatusCode – http response status code
- responseHeaders - response headers

### Settings

- **http/https** - make just one
  - server – `http.createServer` settings
  - **listen** – `http.listen` settings
  - static -
    - url – static url
    - root – static root directory
    - setHeaders – function to set custom headers on response. Alterations to the headers need to occur synchronously.
    - options – [send](https://www.npmjs.com/package/send#options) module options

Minimal settings:

```
settings.http = {
  listen: {
    host: '0.0.0.0',
    port: 3000
  }
}
```

License: MIT.
npm package: @matter-in-motion/validators.jsonschema
Description: Matter in Motion Extension. JSON Schema validator
Author: Alexey Novikov
Latest version: 1.0.0

# Matter In Motion. JSON Schema Validator

[![NPM Version](https://img.shields.io/npm/v/@matter-in-motion/validators.jsonschema.svg?style=flat-square)](https://www.npmjs.com/package/@matter-in-motion/validators.jsonschema)
[![NPM Downloads](https://img.shields.io/npm/dt/@matter-in-motion/validators.jsonschema.svg?style=flat-square)](https://www.npmjs.com/package/@matter-in-motion/validators.jsonschema)

**Node.js framework for building applications (cli, server, etc...).**

## JSON Schema

(JSON Schema)[(http://json-schema.org)] validator extension for [matter in motion](https://github.com/matter-in-motion/mm) framework. Adds [Ajv](https://github.com/epoberezkin/ajv) as `validators.jsonschema` with two plugins [ajv-merge-patch](https://github.com/epoberezkin/ajv-merge-patch) and [ajv-keywords](https://github.com/epoberezkin/ajv-keywords)

### Installation

`npm i @matter-in-motion/validators.jsonschema`

## Usage

1. Add `validators.jsonschema` to your extensions in the settings.

```js
const validator = app.require('validators.jsonschema');
const valid = validator.validate(schema, data);
```

## Settings

All of the [Ajv options](https://github.com/epoberezkin/ajv#options)

License: MIT.
npm package: @matter.js/brorand
Description: Random number generator for browsers and node.js
Author: Fedor Indutny
Latest version: 1.1.0

# @matter.js/Brorand

This is a frk of the original brorand adjusted to always use global.crypto without the checks and is used in matter.js react native builds.

#### LICENSE

This software is licensed under the MIT License.

Copyright Fedor Indutny, 2014.

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the
following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
npm package: @matter.js/browserify-cipher
Description: ciphers for the browser
Author: Calvin Metcalf
Latest version: 1.1.0

browserify-cipher
===

[![Build Status](https://travis-ci.org/crypto-browserify/browserify-cipher.svg)](https://travis-ci.org/crypto-browserify/browserify-cipher)

Provides createCipher, createDecipher, createCipheriv, createDecipheriv and
getCiphers for the browserify.  Includes AES and DES ciphers.
npm package: @mattereum/voltsig
Description: High-entropy human-readable hashes
Author: Alistair Turnbull
Latest version: 1.0.5

# Voltsig

Generate “visual signatures” of binary data that can be used to easily
differentiate up to 67.4 bits.

[Demo](https://mattereum-public.gitlab.io/voltsig/)

Copyright 2021 Alistair Turnbull. Distributed under the MIT licence; see the
file `LICENCE`.

The signatures are generated in colour. The colours used are
indistinguishable when rendered as greyscale, and the signatures are
suitable for users with colour vision deficiency (aka colour blindness);
however, viewing the images in colour gives an additional 9 bits of entropy.

Only the file `voltsig.js` is needed. It defines a single top-level
function:

+ `voltsig(svgElement, s, options)` — Replace the contents of the `<svg>`
  element `svgElement` with an image that represents a hash of `s`.

See `voltsig.js` for more detail.

Other files:

+ `index.html` — An example of how to use `voltsig.js`.
+ `sheep-face.svg` — The default logo (a tiny SVG file).
npm package: @matterhorn-studios/react-fb-auth
Description: A simple ReactJS package ment to make ReactJS/NextJS Firebase authentication easy. 
Author: Matterhorn Studios LLC
Latest version: 1.1.6

# ReactFBAuth

A simple react package ment to make React/NextJS firebase authentication easy.

### Built with Firebase web V9

_currently supports email/password and Google authentication, more will be added soon_

## Setup and Usage

#### Create a Firebase config file

This file will house your Firebase config as well as auth object and its providers. Config object comes from Firebase console.

```typescript
import { initializeApp } from "firebase/app";
import { getAuth, GoogleAuthProvider } from "firebase/auth";

const firebaseConfig = {
  apiKey: "API-KEY",
  authDomain: "EXAMPLE-DOMAIN.firebaseapp.com",
  projectId: "PROJECT-ID",
  storageBucket: "DOMAIN.appspot.com",
  messagingSenderId: "ID",
  appId: "ID",
  measurementId: "ID",
};

// Initialize Firebase
const app = initializeApp(firebaseConfig);

// init auth
export const auth = getAuth(app);

// init google provider
export const gProvider = new GoogleAuthProvider();
gProvider.setCustomParameters({ prompt: "select_account" });
```

#### Add the provider to main

The provider takes in the auth object, the google provider, and the persistence type (https://firebase.google.com/docs/auth/web/auth-state-persistence).

```typescript
import { auth, gProvider } from "./firebase_client";
import { browserLocalPersistence } from "firebase/auth";

ReactDOM.createRoot(document.getElementById("root")!).render(
  <FBAuthProvider
    fb_auth={auth}
    g_provider={gProvider}
    persistence_type={browserLocalPersistence}
  >
    <React.StrictMode>
      <App />
    </React.StrictMode>
  </FBAuthProvider>
);
```

#### Use anywhere

Basic App.tsx example:

```typescript
import { useFBAuth } from "@matterhorn-studios/react-fb-auth";

function App() {
  const { user, loading, error, googleSignIn, logOut } = useFBAuth();

  if (loading) return <h1>LOADING</h1>;
  if (error) return <h1>Error: {error.message}</h1>;
  return (
    <div>
      {user ? (
        <>
          <div>{user.displayName}</div>
          <button onClick={logOut}>log out</button>
        </>
      ) : (
        <>
          <div>no user found</div>
          <button onClick={googleSignIn}>google sign in</button>
        </>
      )}
    </div>
  );
}

export default App;
```

#### Methods on useFBAuth()

- `googleSignIn` Prompts the user to sign in with google, populates the user, loading, and error object
- `emailSignIn(email: string, password: string)` Signs the user in with the provided email and password, populates the user, loading, and error object
- `emailSignUp(email: string, password: string)` Signs the user up with the provided email and password, populates the user, loading, and error object
- `logOut` Logs the user out
- `clearError` Clears the error object (resets it to null)