open-index/open-npm huggingface dataset:
npm package: @postalsys/hecks
Description: Mount your express app onto your hapi server, aw heck!
Author: Devin Ivy
Latest version: 3.0.0-fork.3

| This is a fork of hapipal/hecks. It changes the peer dependency version for Hapi.

# hecks
Mount your express app onto your hapi server, aw heck!

[![Build Status](https://travis-ci.com/hapipal/hecks.svg?branch=master)](https://travis-ci.com/hapipal/hecks) [![Coverage Status](https://coveralls.io/repos/hapipal/hecks/badge.svg?branch=master&service=github)](https://coveralls.io/github/hapipal/hecks?branch=master)

Lead Maintainer - [Devin Ivy](https://github.com/devinivy)

## Installation
```sh
npm install @hapipal/hecks
```

## Usage
> See also the [API Reference](API.md)
>
> Hecks is intended for use with hapi v19+ and nodejs v12+ (see v2 for lower support).

Hecks allows you to seamlessly incorporate express applications into a hapi server.  This is particularly useful for testing an express server using [`server.inject()`](https://github.com/hapijs/hapi/blob/master/API.md#server.inject()), for unifying deployment of existing express and hapi applications, and as an initial stepping stone in migrating an express application to hapi.

```js
const Express = require('express');
const BodyParser = require('body-parser');
const Hapi = require('@hapi/hapi');
const Hecks = require('@hapipal/hecks');

(async () => {

    const app = Express();

    app.post('/user', BodyParser.json(), (req, res) => {

        const user = { ...req.body };
        user.saved = true;

        res.json(user);
    });

    const server = Hapi.server();

    await server.register([
        Hecks.toPlugin(app, 'my-express-app')
    ]);

    const { result } = await server.inject({
        method: 'post',
        url: '/user',
        payload: { name: 'Bill', faveFood: 'cactus' }
    });

    console.log(result); // {"name":"Bill","faveFood":"cactus","saved":true}
})();
```
npm package: @postalsys/multiplex
Description: Binary stream multiplexer - stream multiple streams of binary data over a single binary stream
Author: Postal Systems OÜ
Latest version: 1.0.2

# @postalsys/multiplex

Binary stream multiplexer - stream multiple streams of binary data over a single binary stream.

## Installation

```bash
npm install @postalsys/multiplex
```

## Requirements

- Node.js v22+

## Usage

```javascript
const { PassThrough } = require('stream');
const { Multiplex } = require('@postalsys/multiplex');

const multiplex1 = new Multiplex();
const multiplex2 = new Multiplex();

// Listen for incoming streams
multiplex2.on('stream', (meta, stream) => {
    // stream is Duplex stream
    console.log('STREAM ID', meta.id);
    console.log('TARGET HOST', meta.target.host);
    console.log('TARGET PORT', meta.target.port);

    stream.pipe(process.stdout);
    process.stdin.pipe(stream);
});

// Connect multiplexers
multiplex1.pipe(new PassThrough()).pipe(multiplex2);
multiplex2.pipe(new PassThrough()).pipe(multiplex1);

// Create a new multiplexed stream
const stream = multiplex1.createStream({ target: { host: '1.2.3.4', port: 4567 } });

// Write data to the stream
stream.write(Buffer.from('Stream data'));

// Read data from the stream
stream.on('readable', () => {
    let chunk;
    while ((chunk = stream.read()) !== null) {
        console.log(chunk.toString());
    }
});
```

## API

### `new Multiplex(options)`

Creates a new Multiplex instance. The Multiplex class extends Transform stream.

### `multiplex.createStream(meta)`

Creates a new multiplexed stream with optional metadata.

- `meta` (Object): Optional metadata to associate with the stream
  - `id` (String): Optional stream ID. If not provided, a unique ID will be auto-assigned
  - Other properties: Any additional metadata you want to pass
- Returns: MultiplexStream instance (Duplex stream)

### Event: 'stream'

Emitted when a new stream is received from the remote multiplex.

- `meta` (Object): Metadata associated with the stream
- `stream` (MultiplexStream): The received duplex stream

## Testing

Run tests using Node.js built-in test runner:

```bash
npm test
```

## License

MIT
npm package: @postalsys/toys
Description: The hapi utility toy chest
Author: Devin Ivy
Latest version: 3.1.0-fork.1

# toys

The hapi utility toy chest

[![Build Status](https://travis-ci.org/hapipal/toys.svg?branch=master)](https://travis-ci.org/hapipal/toys) [![Coverage Status](https://coveralls.io/repos/hapipal/toys/badge.svg?branch=master&service=github)](https://coveralls.io/github/hapipal/toys?branch=master)

Lead Maintainer - [Devin Ivy](https://github.com/devinivy)

## Installation
```sh
npm install @hapipal/toys
```

## Usage
> See also the [API Reference](API.md)
>
> Toys is intended for use with hapi v19+ and nodejs v12+ (_see v2 for lower support_).

Toys is a collection of utilities made to reduce common boilerplate in **hapi v19+** projects, aid usage of events and streams in `async` functions (e.g. handlers and server methods), and provide versions of widely-used utilities from [Hoek](https://github.com/hapijs/hoek) optimized to perform well in hot code paths such as route handlers.

Below is an example featuring [`Toys.auth.strategy()`](API.md#toysauthstrategyserver-name-authenticate), [`Toys.reacher()`](API.md#toysreacherchain-options), and [`Toys.withRouteDefaults()`](API.md#toyswithroutedefaultsdefaults).  The [API Reference](API.md) is also filled with examples.

```js
const Hapi = require('@hapi/hapi');
const Boom = require('@hapi/boom');
const Toys = require('@hapipal/toys');

(async () => {

    const server = Hapi.server();

    // Make a one-off auth strategy for testing
    Toys.auth.strategy(server, 'name-from-param', (request, h) => {

        // Yes, perhaps not the most secure
        const { username } = request.params;

        if (!username) {
            throw Boom.unauthorized(null, 'Custom');
        }

        return h.authenticated({ credentials: { user: { name: username } } });
    });

    // Make function to efficiently index into a request to grab an authed user's name
    const grabAuthedUsername = Toys.reacher('auth.credentials.user.name');

    // Default all route methods to "get", unless otherwise specified
    const defaultToGet = Toys.withRouteDefaults({ method: 'get' });

    server.route(
        defaultToGet([
            {
                method: 'post',
                path: '/',
                handler: (request) => {

                    return { posted: true };
                }
            },
            {   // Look ma, my method is defaulting to "get"!
                path: '/as/{username}',
                options: {
                    auth: 'name-from-param', // Here's our simple auth strategy
                    handler: (request) => {

                        // grabAuthedUsername() is designed to be quick
                        const username = grabAuthedUsername(request);

                        return { username };
                    }
                }
            }
        ])
    );

    await server.start();

    console.log(`Now, go forth and ${server.info.uri}/as/your-name`);
})();
```
npm package: @postanu/eslint-config
Description: ESLint shareable config for Postanu
Author: Eduard Aksamitov
Latest version: 7.0.0

# Postanu ESLint sharable config

## Install

### JavaScript

```sh
pnpm add --save-dev @postanu/eslint-config eslint
```

### TypeScript

```sh
pnpm add --save-dev @postanu/eslint-config eslint typescript typescript-eslint
```

### Vue + TypeScript

```sh
pnpm add --save-dev @postanu/eslint-config eslint typescript typescript-eslint eslint-plugin-vue
```

### Astro + TypeScript

```sh
pnpm add --save-dev @postanu/eslint-config eslint typescript typescript-eslint eslint-plugin-astro astro-eslint-parser
```
npm package: @postanu/stylelint-config
Description: Stylelint sharable config for Postanu
Author: Eduard Aksamitov
Latest version: 1.0.0

# Postanu Stylelint sharable config

## Install

```sh
pnpm add --save-dev @postanu/stylelint-config stylelint postcss
```

> [!NOTE]
> It uses patched `postcss-html` with `sugarss` instead of broken `postcss-sass` for Vue SFC parsing.