open-index/open-npm huggingface dataset:
npm package: @hitchcott/gatsby-remark-custom-image-component
Description: Locate `gatsby-plugin-sharp` processed images for custom markdown components
Author: Derek Nguyen
Latest version: 1.0.2

# gatsby-remark-custom-image-component

This `gatsby-transformer-remark` plugin allows you to link images in [custom components](https://using-remark.gatsbyjs.org/custom-components/) in a similar fashion to `gatsby-remark-image`.

## Install

```bash
npm install gatsby-remark-custom-image-component
yarn add gatsby-remark-custom-image-component
```

## Usage

```js
// gatsby-config.js
module.exports = {
  plugins: [
    {
      resolve: `gatsby-transformer-remark`,
      options: {
        plugins: [
          {
            resolve: `gatsby-remark-custom-image-component`,
            options: {
              // plugin options
              componentName: 'image-wrapper',
              imagePropName: 'src',
              sharpMethod: 'fluid',
              // fluid's arguments
              quality: 50,
              maxWidth: 800,
            }
          },
        ],
      },
    },
```

In your markdown:

```yaml
# src/content/hello-word/index.md
---
title: Hello World
date: '2015-05-01T22:12:03.284Z'
---

<image-wrapper src='./hero.jpg'></image-wrapper>
```

In your custom component:
```js
//src/components/ImageWrapper.js
import React from 'react'

// the result of sharp's image transformation will be passed directly to this component.
// so if you use `fluid` as `sharpMethod`, you'll get
// src, srcSet, base64, aspectRatio, srcSetType, sizes, density, originalImage. 
// Please refer to `gatsby-plugin-sharp` docs.
const ImageWrapper =  ({ src, srcSet }) => <img src={src} srcSet={srcSet} />

export { ImageWrapper }
```

In your template:

```js
//src/templates/blog-post.js
import React from 'react'
import rehypeReact from 'rehype-react'
import { ImageWrapper } from '../components/ImageWrapper'

const renderAst = new rehypeReact({
  createElement: React.createElement,
  components: { 'image-wrapper': ImageWrapper }, // register our component
}).Compiler

const BlogPostTemplate = ({ data }) => {
  const post = this.props.data.markdownRemark
  return <div>{ renderAst(post.htmlAst) }</div>
}

export default BlogPostTemplate

export const pageQuery = graphql`
  query BlogPostBySlug($slug: String!) {
    markdownRemark(fields: { slug: { eq: $slug } }) {
      htmlAst
    }
  }
`
```

## Options

| Name | Value | Note |
|---|---|---|
|componentName| string, default 'image-wrapper' | Custom component name, use in markdown |
|imagePropName| string, default 'src' | |
|sharpMethod| string, default 'fluid' | Sharp method, one of 'resize', 'fluid' or 'fixed'|

You can also pass in any of the selected sharp method's arguments. [Reference here](https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-plugin-sharp).
npm package: @hitchy/core
Description: _server-side web application framework_
Author: cepharum GmbH
Latest version: 1.5.5

# Hitchy [![pipeline status](https://gitlab.com/hitchy/core/badges/master/pipeline.svg)](https://gitlab.com/hitchy/core/-/commits/master)

_server-side web application framework_

## License

[MIT](LICENSE)

## Documentation

The official documentation is available at https://core.hitchy.org/.
npm package: @hitchy/plugin-auth
Description: user authentication and authorization for Hitchy
Author: cepharum GmbH
Latest version: 0.6.3

# @hitchy/plugin-auth

[![pipeline status](https://gitlab.com/hitchy/plugin-auth/badges/master/pipeline.svg)](https://gitlab.com/hitchy/plugin-auth/-/commits/master)

_request authentication and authorization for Hitchy framework_

## License

[MIT](LICENSE)

## Usage

Run this command in a hitchy-based project's root folder containing its **package.json** file:

```
npm i @hitchy/plugin-auth
```

It will install this plugin as a dependency.

After restarting your application the plugin is discovered by Hitchy automatically. It is injecting some routes instantly suitable for authentication based on a local database.

## Manual

Read the [plugin's official manual](https://auth.hitchy.org/) e.g. for [routes supported by default](https://auth.hitchy.org/api/routing.html) and how to use [all the components this plugin is introducing](https://auth.hitchy.org/api/).
npm package: @hitchy/plugin-cookies
Description: per-request cookie parser for Hitchy
Author: cepharum GmbH
Latest version: 0.1.9

# @hitchy/plugin-cookies [![pipeline status](https://gitlab.com/hitchy/plugin-cookies/badges/master/pipeline.svg)](https://gitlab.com/hitchy/plugin-cookies/-/commits/master)

_per-request cookie parser for [Hitchy](https://hitchy.org/)_

## License

[MIT](LICENSE)

## Usage

In your [Hitchy-based](https://hitchy.org/) application run
 
```
npm install --save @hitchy/plugin-cookies
```

On start of your application, it is discovering the plugin which is automatically injecting a new policy parsing every request's header for provided cookies exposing them in [`req.cookies`](https://core.hitchy.org/api/#req-cookies) in handlers of any succeeding policy or controller.
npm package: @hitchy/plugin-mailer
Description: easily integrate Nodemailer with Hitchy
Author: Thomas Urban
Latest version: 0.1.0

# @hitchy/plugin-mailer

_integrate NodeMailer with Hitchy_

## License

[MIT](LICENSE)

## Installation

1. Install the plugin in a Hitchy-based project:

   ```bash
   npm i @hitchy/plugin-mailer
   ```

2. Set up configuration in a file **config/mailer.js** with a content similar to this:

   ```javascript
   exports.mailer = {
       transport: "smtps://loginUser:loginPassword@smtp.example.com",
       template: {
		   from: "noreply@my-company.com",
       },
   };
   ```

## Usage

In your server-side code, sending a mail is as easy as this:

```javascript
module.exports = function() {
    const api = this;

    return {
        async handleRequest( req, res ) {
            try {
                await api.service.Mail.sendTextMail(
                    "recipient@partner.com",
                    "Test mail subject",
                    "This is my test message."
                );
				
                res.json( { success: true } );
            } catch {
                res.status( 500 ).json( {
                    error: "sending mail failed"
                } );
            }
        }
    };
}
```

In this example, convenience helper `api.service.Mail.sendTextMail()` is invoked with a recipient, a subject and the message. It returns a promise to be resolved when sending mail has succeeded.

### API

The service provides these methods:

#### sendTextMail( recipient, subject, message )

Sends a plain-text message with given content and subject to provided recipient.

#### sendMail( information )

Sends a message composed from provided information which is an object in compliance with Nodemailer's [support for describing a mail to compose](https://nodemailer.com/message/). The provided information is merged with [configured template](#configuration).

The method returns a promise resolved when sending mail has succeeded.

## Configuration

The plugin's configuration is related to Nodemailer configuration:

* **transport** is either a string describing an SMTP service to use or some object used to create the transport as [supported by Nodemailer](https://nodemailer.com/smtp/).

* **template** is an [object of properties](https://nodemailer.com/message/) any outgoing mail is composed with as its defaults. A sender's address must be given in property **from** at least.

  Including a subject, a message or a recipient might not work as expected there when using convenience helper methods such as `Mail.sendTextMail()`.
npm package: @hitchy/plugin-odem
Description: a document-oriented database for Hitchy-based applications
Author: cepharum GmbH
Latest version: 0.14.0

# Hitchy Odem [![pipeline status](https://gitlab.com/hitchy/plugin-odem/badges/master/pipeline.svg)](https://gitlab.com/hitchy/plugin-odem/-/commits/master)

_a document-oriented database for Hitchy_

## License

[MIT](LICENSE)

## About

[Hitchy](https://core.hitchy.org/) is a lean server-side application framework focusing on these features:

* Easily discover plugins.
* Quickly dispatch incoming requests to handlers of those plugins.

Hitchy requires a plugin like this one to conveniently manage data. Hitchy Odem provides a document-oriented database for Hitchy. It is working on top of a key-value store relying on customizable backend adapters. There are two backends included with this plugin:

 * A memory-based adapter manages data in volatile runtime memory mostly for developing and testing purposes. It is the default backend.
 * A filesystem-based adapter is storing all data in a customizable folder of your local filesystem. This backend is suitable for persistently storing data in a single-server context.

In addition, there is [a separate plugin](https://www.npmjs.com/package/@hitchy/plugin-odem-etcd) providing an adapter for using an etcd3 cluster as backend in a multiple-server context.

### Performance and memory consumption

Hitchy Odem supports index-based searching to significantly improve its performance on finding items when used with a filesystem-based data store or some dedicated etcd cluster. Indexes are rebuilt in runtime memory on every start of your Hitchy-based service. For that, all items of models with declared indexes are fetched from those stores on start. This results in increased memory consumption and boot time closely related to the number of items in your data store.

Of course, Hitchy Odem is not designed to compete with established database engines like MySQL or MongoDB. However, most applications work with rather small sets of data and thus do not benefit much from those engines for the memory consumption and boot time are still rather low. On the other hand, using Hitchy in combination with Hitchy Odem comes with very little prerequisites for the server they are running on. For example, it takes a single Docker container to run your application. There is no need to have composition of containers combining a sophisticated database engine with your application. That's following one of the core-principles of Hitchy: getting rid of dependencies as good as possible.

## Documentation

The latest documentation is available at https://odem.hitchy.org/.
npm package: @hitchy/plugin-socket.io
Description: integrating socket.io server with Hitchy framework
Author: cepharum GmbH
Latest version: 0.1.3

# @hitchy/plugin-socket.io

_integrates socket.io server with Hitchy framework_

## License

[MIT](LICENSE)

## Installation

```bash
npm i @hitchy/plugin-socket.io
```

## Usage

The websocket server of socket.io gets automatically integrated with Hitchy on next start of application. The server instance is exposed as [api.websocket](https://core.hitchy.org/api/hitchy.html#api-websocket).

Hitchy's official features are exposed in namespace `/hitchy`.

### Request handling

Hitchy starts listening to connected websocket clients emitting `request` messages describing requests to be dispatched mostly equivalent to the way regular HTTP requests to Hitchy are handled. Using the websocket is performing slightly better than separate HTTP requests.

On a client, you can use it like this:

```javascript
io( "/hitchy" ).emit( "request", { 
    method: "POST",
    url: "/api/foo?q=bar",
    headers: { 
        // put request headers here
    },
    body: { 
        // provide some object with your payload data 
    },
}, ( { statusCode, headers, body } ) => {
    // TODO: handle the response
} );
```

Providing an object as request body is the preferred way. It gets implicitly serialized as JSON body on dispatching the request on server side. The `content-type` request header may be omitted and must not be set to anything but `text/json` or `application/json`. You can also provide a string or ArrayBuffer, in which case any custom `content-type` request header can be provided, too.

The response body may be data already parsed from a server-side JSON-response.

### Custom application: handle requests

On server-side, you can have a service including code like this:

```javascript
api.websocket.on( "connext", socket => {
    socket.on( "some-request", ( data, response ) => {
        // TODO process `data`, calculate `result`
        
        response( result );
    } );
} );
```

On client side, you can use that like this:

```javascript
socket.emit( "some-request", data, result => {
    // TODO process the result
} );
```

### Custom application: respond to server notifications

On server-side, you can emit broadcast notifications like this:

```javascript
api.websocket.emit( "some-update", data );
```

On client side, you can receive these notifications like this:

```javascript
socket.on( "some-update", data => {
    // TODO process the data
} );
```
npm package: @hitchy/server-dev-tools
Description: toolkit for testing plugins and applications basing on Hitchy
Author: cepharum GmbH
Latest version: 0.9.6

# @hitchy/server-dev-tools [![pipeline status](https://gitlab.com/hitchy/server-dev-tools/badges/master/pipeline.svg)](https://gitlab.com/hitchy/server-dev-tools/-/commits/master)

_toolkit for testing plugins and applications based on [Hitchy](https://www.npmjs.com/package/@hitchy/core)_

## License

[MIT](LICENSE)

## Manual

The full manual is available at [https://sdt.hitchy.org/](https://sdt.hitchy.org/).
npm package: @hitchy/types
Description: type definitions for Hitchy server-side framework
Author: cepharum GmbH
Latest version: 0.1.3

# Hitchy type definitions

## License

[MIT](LICENSE)

## About

This package is extracting definition of types specific to the [Hitchy server-side framework](https://core.hitchy.org/) to make them available independently of the framework's core improving their use with plugins which usually don't have the core as a dependency (but peer dependency).

## Usage

Install with

```bash
npm i -D @hitchy/types
```