open-index/open-npm huggingface dataset:
npm package: @machinat/core
Description: The sociable app framework
Author: Patrick Liu
Latest version: 0.6.0

# Machinat Core

This is the core module of Machinat framework.

## Install

```bash
npm install @machinat/core
# or with yarn
yarn add @machinat/core
```

## Docs

Check the [framework documents](https://machinat.com/docs/) and the
[package references](https://machinat.com/api/modules/core.html).
npm package: @machinat/create-app
Description: Project creator for Machinat framework.
Author: Patrick Liu
Latest version: 0.6.0

# Create Machinat App

Project creator for Machinat framework.

## Usage

Create a hello-world project with specified platforms:

```bash
# with npm
npm init @machinat/app@latest -- -p <platform> [-p ...] [--webview] my-project

# with yarn
yarn create @machinat/app -- -p <platform> [-p ...] [--webview] my-project
```

## Docs

Check the [Getting Started](https://machinat.com/docs/#create-machinat-app)
document for the usage guide.
npm package: @machinat/dev-state
Description: This module implement the [`BaseStateController`](https://machinat.com/api/modules/core_base_statecontroller.html) with in-memory and file storage. We suggest to use them for testing purpose only.
Author: Patrick Liu
Latest version: 0.5.0-beta.30

# Dev State Module

This module implement the [`BaseStateController`](https://machinat.com/api/modules/core_base_statecontroller.html)
with in-memory and file storage. We suggest to use them for testing purpose only.

## Install

```bash
npm install @machinat/core @machinat/dev-state
# or with yarn
yarn add @machinat/core @machinat/dev-state
```

## Docs

Check the [Using State](https://machinat.com/docs/using-states) document for the
usage guide, and the [package reference](https://machinat.com/api/modules/dev_state.html)
for API details.

## Setup

#### In-Memory State

```js
import Machinat from '@machinat/core';
import { InMemoryState } from '@machinat/dev-state';

const app = Machinat.createApp({
  modules: [
    InMemoryState.initModule(),
  ],
});
```

#### File State

```js
import Machinat from '@machinat/core';
import { FileState } from '@machinat/dev-state';
import YAML from 'yaml';

const app = Machinat.createApp({
  modules: [
    FileState.initModule({
      path: './.state_storage.json',
    }),
  ],
  services: [
    // you can swap the serializer
    { provide: FileState.Serializer, withValue: YAML }
  ],
});
```
npm package: @machinat/dev-tools
Description: This module consists services that is useful for development.
Author: Patrick Liu
Latest version: 0.6.0

# Dev Tools Module

This module consists services that is useful for development.

## Install

```bash
npm install @machinat/core @machinat/dev-tools
# or with yarn
yarn add @machinat/core @machinat/dev-tools
```

## Docs

Check the [package references](https://machinat.com/api/modules/dev_tools.html).

## Services

### In-Memory State

An in-memory implementation of [`StateController`](https://machinat.com/api/modules/core_base_statecontroller.html). Check the [Using State](https://machinat.com/docs/using-states) document for usage guides.

#### Setup

```js
import Machinat from '@machinat/core';
import { InMemoryState } from '@machinat/dev-tools';

const app = Machinat.createApp({
  modules: [
    InMemoryState.initModule(),
  ],
});
```

### File State

An implementation of [`StateController`](https://machinat.com/api/modules/core_base_statecontroller.html) that stores state data in a local file for easy debugging. Check the [Using State](https://machinat.com/docs/using-states) document for usage guides.

#### Setup

```js
import Machinat from '@machinat/core';
import { FileState } from '@machinat/dev-tools';
import YAML from 'yaml';

const app = Machinat.createApp({
  modules: [
    FileState.initModule({
      path: './.state_storage.json',
    }),
  ],
  services: [
    // you can swap the serializer
    { provide: FileState.Serializer, withValue: YAML }
  ],
});
```

### RegExp Intent Recognition

An simple [`IntentRecognizer`](https://machinat.com/api/modules/core_base_intentrecognizer.html)
implementation using `RegExp`.
Check the [Recognizing Intent](https://machinat.com/docs/recognizing-intent) document for usage guides.

#### Setup

```js
import Machinat from '@machinat/core';
import { RegexIntentRecognition } from '@machinat/dev-tools';

const app = Machinat.createApp({
  modules: [
    RegexIntentRecognition.initModule({
      recognitionData: {
        defaultLanguage: 'en',
        languages: ['en', 'ja'],
        intents: {
          hello: {
            trainingPhrases: {
              en: ['hello', 'hi'],
              ja: ['こんにちは', 'おはよう'],
            },
          },
          goodBye: {
            trainingPhrases: {
              en: ['bye', 'see ya'],
              ja: ['さようなら'],
            },
          },
        },
      },
    }),
  ],
});
```
npm package: @machinat/ejson
Description: **This package is derived from EJSON module of Meteor. You can check the original source at:** [Source code of released version](https://github.com/meteor/meteor/tree/master/packages/ejson) | [Source code of development version](https://github.com/meteor/
Latest version: 0.1.0

# ejson
**This package is derived from EJSON module of Meteor. You can check the original source at:**
[Source code of released version](https://github.com/meteor/meteor/tree/master/packages/ejson) | [Source code of development version](https://github.com/meteor/meteor/tree/devel/packages/ejson)
***

EJSON is an extension of JSON to support more types. It supports all JSON-safe
types, as well as:

 - **Date** - JavaScript `Date`
 - **Binary** - JavaScript `Uint8Array` or the
   result of [`EJSON.newBinary`](http://docs.meteor.com/#ejson_new_binary)
 - **User-defined types** - see [`EJSON.addType`](http://docs.meteor.com/#ejson_add_type)

All EJSON serializations are also valid JSON.  For example an object with a date
and a binary buffer would be serialized in EJSON as:

    {
      "d": {"$date": 1358205756553},
      "b": {"$binary": "c3VyZS4="}
    }

For more details, see the [EJSON section](http://docs.meteor.com/#ejson) of the Meteor docs.
npm package: @machinat/http
Description: This module provide HTTP listening capability to all the services require it. For example, to serve a webhook for subscribing events from chat platform.
Author: Patrick Liu
Latest version: 0.6.0

# Http Module

This module provide HTTP listening capability to all the services require it.
For example, to serve a webhook for subscribing events from chat platform.

## Install

```bash
npm install @machinat/core @machinat/http
# or with yarn
yarn add @machinat/core @machinat/http
```

## Docs

Check the [package reference](https://machinat.com/api/modules/http.html).

## Setup

Use `listenOptions` to set the network options for [`server.listen()`](https://nodejs.org/dist/latest/docs/api/net.html#net_server_listen_options_callback).

```js
import Machinat from '@machinat/core';
import Http from '@machinat/http';

const app = Machinat.createApp({
  modules: [
    Http.initModule({
      listenOptions: {
        port: 8080,
        host: 'localhost',
      }
    }),
  ],
});
```

## Usage

Provide `Http.RequestRouteList` or `Http.UpgradeRouteList` (for [WebSocket](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API))
to register RPC style routes. All the requests under the registered `path` will
be received by the handler. You can also use `default: true` to catch all
unmatch requests.

```js
const app = Machinat.createApp({
  modules: [
    Http.initModule({ /* ... */ }),
  ],
  service: [
    { // route listening to /api
      provide: Http.RequestRouteList,
      withValue: {
        name: 'my_api',
        path: '/api',
        handler: (req, res) => {
          // handle http requests
        },
      }
    },
    { // default request route
      provide: Http.RequestRouteList,
      withValue: {
        name: 'default',
        default: true,
        handler: (req, res) => {
          // catch requests not matching any route
        },
      }
    },
    {  // handle WebSocket connection
      provide: Http.UpgradeRouteList,
      withValue: {
        name: 'web_socket',
        path: '/',
        handler: (req, head, socket) => {
          // handle http upgrade requests
        },
      }
    },
  ],
});
```
npm package: @machinat/jest-snapshot-serializer
Description: Format Machinat JSX elements in the [jest snapshot](https://jestjs.io/docs/snapshot-testing).
Author: Patrick Liu
Latest version: 0.6.0

# Jest Snapshot Serializer

Format Machinat JSX elements in the [jest snapshot](https://jestjs.io/docs/snapshot-testing).

## Install

```bash
npm install @machinat/jest-snapshot-serializer
# or with yarn
yarn add @machinat/jest-snapshot-serializer
```

## Setup

Add the serializer to into `jest.config.js`:

```js
module.exports = {
  // ...
  snapshotSerializers: ['@machinat/jest-snapshot-serializer'],
};
```

Or `packages.json`:

```json
{
  "name": "my-project",
  "jest": {
    "snapshotSerializers": ["@machinat/jest-snapshot-serializer"],
  }
}
```

## Example

```js
expect(
  <GenericTemplate imageAspectRatio="square" sharable>
    <GenericItem
      title="foo"
      imageUrl="http://foo.bar/image"
      buttons={<UrlButton title="check" url="http://xxx.yy.z" />}
    />
  </GenericTemplate>
).toMatchInlineSnapshot(`
  <GenericTemplate
    imageAspectRatio="square"
    sharable={true}
  >
    <GenericItem
      buttons={
        <UrlButton
          title="check"
          url="http://xxx.yy.z"
        />
      }
      imageUrl="http://foo.bar/image"
      title="foo"
    />
  </GenericTemplate>
`);
```
npm package: @machinat/line
Description: Receive events and send messages through [LINE](https://developers.line.biz/en/docs/messaging-api/overview/) messaging API.
Author: Patrick Liu
Latest version: 0.6.0

# Line Platform

Receive events and send messages through [LINE](https://developers.line.biz/en/docs/messaging-api/overview/)
messaging API.

## Install

```bash
npm install @machinat/core @machinat/http @machinat/line
# or with yarn
yarn add @machinat/core @machinat/http @machinat/line
```

## Docs

Check the [platform document](https://machinat.com/docs/line-platform) 
and the [package reference](https://machinat.com/api/modules/line.html).

## Setup

```ts
import Machinat from '@machinat/core';
import Http from '@machinat/http';
import Line from '@machinat/line';

const {
  LINE_PROVIDER_ID,
  LINE_CHANNEL_ID,
  LINE_ACCESS_TOKEN,
  LINE_CHANNEL_SECRET,
} = process.env;

const app = Machinat.createApp({
  modules: [
    Http.initModule({ /* ... */ }),
  ],
  platforms: [
    Line.intiModule({
      webhookPath: '/webhook/line',
      providerId: LINE_PROVIDER_ID,
      channelId: LINE_CHANNEL_ID,
      accessToken: LINE_ACCESS_TOKEN,
      channelSecret: LINE_CHANNEL_SECRET,
    }),
  ],
});
```
npm package: @machinat/local-state
Description: This module implement the [`BaseStateController`](https://machinat.com/api/modules/core_base_statecontroller.html) with in-memory and file storage. We suggest to use them for testing purpose only.
Author: Patrick Liu
Latest version: 0.5.0-beta.18

# Local State Module

This module implement the [`BaseStateController`](https://machinat.com/api/modules/core_base_statecontroller.html)
with in-memory and file storage. We suggest to use them for testing purpose only.

## Install

```bash
npm install @machinat/core @machinat/local-state
# or with yarn
yarn add @machinat/core @machinat/local-state
```

## Docs

Check the [Using State](https://machinat.com/docs/using-states) document for the
usage guide, and the [package reference](https://machinat.com/api/modules/local_state.html)
for API details.

## Setup

#### In-Memory State

```js
import Machinat from '@machinat/core';
import { InMemoryState } from '@machinat/local-state';

const app = Machinat.createApp({
  modules: [
    InMemoryState.initModule(),
  ],
});
```

#### In-Memory State

```js
import Machinat from '@machinat/core';
import { FileState } from '@machinat/local-state';
import YAML from 'yaml';

const app = Machinat.createApp({
  modules: [
    FileState.initModule({
      path: './.state_storage.json',
    }),
  ],
  services: [
    // you can swap the serializer
    { provide: FileState.Serializer, withValue: YAML }
  ],
});
```
npm package: @machinat/messenger
Description: Messenger platform for Machinat.
Author: Patrick Liu
Latest version: 0.6.0

# Messenger Platform

Receive events and send messages through [Messenger platform](https://developers.facebook.com/docs/messenger-platform/).

## Install

```bash
npm install @machinat/core @machinat/http @machinat/messenger
# or with yarn
yarn add @machinat/core @machinat/http @machinat/messenger
```

## Docs

Check the [platform document](https://machinat.com/docs/messenger-platform)
and the [package reference](https://machinat.com/api/modules/messenger.html).

## Setup

```ts
import Machinat from '@machinat/core';
import Http from '@machinat/http';
import Messenger from '@machinat/messenger';

const {
  MESSENGER_PAGE_ID,
  MESSENGER_APP_ID,
  MESSENGER_ACCESS_TOKEN,
  MESSENGER_APP_SECRET,
  MESSENGER_VERIFY_TOKEN,
} = process.env;

const app = Machinat.createApp({
  modules: [
    Http.initModule({ /* ... */ }),
  ],
  platforms: [
    Messenger.intiModule({
      entryPath: '/webhook/messenger',
      pageId: MESSENGER_PAGE_ID,
      appSecret: MESSENGER_APP_SECRET,
      accessToken: MESSENGER_ACCESS_TOKEN,
      verifyToken: MESSENGER_VERIFY_TOKEN,
    }),
  ],
});
```
npm package: @machinat/next
Description: This package is an underlying module of webview platform for serving a [Next.js](https://nextjs.org) web front-end. You might want to use [`@machinat/webview`](https://github.com/machinat/machinat/tree/master/packages/webview) unless you want to serve you
Author: Patrick Liu
Latest version: 0.6.0

# Next Module

This package is an underlying module of webview platform for serving a [Next.js](https://nextjs.org)
web front-end. You might want to use [`@machinat/webview`](https://github.com/machinat/machinat/tree/master/packages/webview)
unless you want to serve your own web service.

## Install

```bash
npm install @machinat/core @machinat/http @machinat/next
# or with yarn
yarn add @machinat/core @machinat/http @machinat/next
```

## Docs

Check the [package reference](https://machinat.com/api/modules/next.html).

## Setup

Assume you have the Next.js project at `../webview`, set up the module like
this:

```js
import Machinat from '@machinat/core';
import Http from '@machinat/http';
import Next from '@machinat/next';
import nextConfigs from '../webview/next.config.js'

const DEV = process.env.NODE_ENV !== 'production';

const app = Machinat.createApp({
  modules: [
    Http.initModule({ /* ... */ }),
    Next.initModule({
      entryPath: '/webview',   // have to match bastPath in next configs
      serverOptions: {
        dev: DEV,              // start with dev mode or not
        dir: '../webview',     // next.js app project dir
        conf: nextConfigs,     // imported next configs
      },
    }),
  ],
});
```
npm package: @machinat/per-env
Description: Clean up your package.json with per-NODE_ENV npm scripts
Author: Eric Clemmons
Latest version: 1.1.0

# per-env

> Clean up your `package.json` with per-`NODE_ENV` npm scripts.

[![travis build](https://img.shields.io/travis/ericclemmons/per-env.svg)](https://travis-ci.org/ericclemmons/per-env)
[![version](https://img.shields.io/npm/v/per-env.svg)](http://npm.im/per-env)
[![downloads](https://img.shields.io/npm/dm/per-env.svg)](http://npm-stat.com/charts.html?package=per-env)
[![MIT License](https://img.shields.io/npm/l/per-env.svg)](http://opensource.org/licenses/MIT)


### Features

- [x] Defaults `NODE_ENV` to `development`.
- [x] Customize `process.env` per-environment.
- [x] Clearer, concise scripts.
- [x] No more Bash-scripting in `package.json`.
- [x] Simplify your workflow:
  1. `npm install`
  2. `npm start`


### Example

```js
{
  // Processes spawned by `per-env` inherit environment-specific
  // variables, if defined.
  "per-env": {
    "production": {
      "DOCKER_USER": "my",
      "DOCKER_REPO": "project"
    }
  },
  "scripts": {
    // If NODE_ENV is missing, defaults to "development".
    "build": "per-env",

    "build:development": "webpack -d --watch",
    "build:staging": "webpack -p",
    "build:production": "webpack -p",

    // Deployment won't work unless NODE_ENV=production is explicitly set.
    "deploy": "per-env",

    "predeploy:production": "docker build -t ${DOCKER_USER}/${DOCKER_PROJECT} .",
    "deploy:production": "docker push ${DOCKER_USER}/${DOCKER_PROJECT}",

    // "npm start" is _the_ command to start the server across all environments.
    "start": "per-env",

    "start:development": "npm run build:development",

    "prestart:production": "npm run build",
    "start:production": "start-cluster build/server/server.js",

    "prestart:staging": "npm run build",
    "start:staging": "start-cluster build/server/server.js",

    // Explicitly set NODE_ENV, which is helpful in CI.
    "test": "NODE_ENV=test per-env",

    "test:test": "mocha"
  }
}
```


### Installation

```shell
$ npm install --save per-env
```


### License

> MIT License 2016 © Eric Clemmons
npm package: @machinat/redis-state
Description: This module implement the [`BaseStateController`](https://machinat.com/api/modules/core_base_statecontroller.html) interface with redis in-memory database.
Author: Patrick Liu
Latest version: 0.6.0

# Redis State Module

This module implement the [`BaseStateController`](https://machinat.com/api/modules/core_base_statecontroller.html)
interface with redis in-memory database.

## Install

```bash
npm install @machinat/core @machinat/redis-state
# or with yarn
yarn add @machinat/core @machinat/redis-state
```

## Docs

Check the [Using State](https://machinat.com/docs/using-states)
document and the [package reference](https://machinat.com/api/modules/redis_state.html).

## Setup

```js
import Machinat from '@machinat/core';
import RedisState from '@machinat/redis-state';

const app = Machinat.createApp({
  modules: [
    RedisState.initModule({
      clientOptions: {
        host: 'localhost',
        port: 6379,
      },
    }),
  ],
});
```
npm package: @machinat/script
Description: Control conversation flow with programming language styled script.
Author: Patrick Liu
Latest version: 0.6.0

# Script Module

Control conversation flow with programming language styled script.

## Install

```bash
npm install @machinat/core @machinat/http @machinat/script
# or with yarn
yarn add @machinat/core @machinat/http @machinat/script
```

## Docs

Check the [Dialog Script](https://machinat.com/docs/dialog-script)
document and the [package reference](https://machinat.com/api/modules/script.html).

## Setup

Register the built script like this:

```js
import Machinat from '@machinat/core';
import Script from '@machinat/script';
import BeforeSunrise from './scenes/BeforeSunset';
import BeforeSunset from './scenes/BeforeSunset';
import BeforeMidnight from './scenes/BeforeSunset';

const app = Machinat.createApp({
  modules: [
    Script.initModule({
      libs: [
        BeforeSunrise,
        BeforeSunset,
        BeforeMidnight,
      ],
    }),
  ],
});
```
npm package: @machinat/stream
Description: Reactive programming library for Machinat.js
Author: Patrick Liu
Latest version: 0.6.0

# Machinat Stream

Reactive programming stream for handling events in back-end.

> ⚠ This package is still on early experimental. There might be breaking changes
> in the future for supporting cluster. You can check the future road map [here](https://machinat.com/docs/reactive-programming/#designs-and-road-map).

## Install

```bash
npm install @machinat/stream
# or with yarn
yarn add @machinat/stream
```

## Docs

Check the [Reactive Programming](https://machinat.com/docs/reactive-programming)
document and the [package reference](https://machinat.com/api/modules/stream.html).

## Example

```js
import { makeContainer, IntentRecognizer } from '@machinat/core';
import { fromApp } from '@machinat/stream';
import { map, filter } from '@machinat/stream/operators';
import app from './app';

const event$ = fromApp(app);

const textMsg$ = events$.pipe(
  filter(({ event }) => event.type === 'text'),
  map(
    makeContainer({ deps: [IntentRecognizer] })(
      (recognizer) =>
        async (context) => {
          const { channel, text } = context.event;
          const intent = await recognizer.detectText(channel, text);
          return { ...context, intent };
        }
    )
  )
);

textMsg$.subscribe(async ({ intent, reply }) => {
  const action = intent.type;
  if (action) {
    await reply(`start ${action}...`);
  }
});
```
npm package: @machinat/telegram
Description: Messenger platform for Machinat.
Author: Patrick Liu
Latest version: 0.6.0

# Telegram Platform

Receive events and send messages through [Telegram](https://developers.facebook.com/docs/telegram-platform/).

## Install

```bash
npm install @machinat/core @machinat/http @machinat/telegram
# or with yarn
yarn add @machinat/core @machinat/http @machinat/telegram
```

## Docs

Check the [platform document](https://machinat.com/docs/telegram-platform)
and the [package reference](https://machinat.com/api/modules/telegram.html).

## Setup

```ts
import Machinat from '@machinat/core';
import Http from '@machinat/http';
import Telegram from '@machinat/telegram';

const {
  TELEGRAM_BOT_NAME,
  TELEGRAM_BOT_TOKEN,
  TELEGRAM_SECRET_PATH,
} = process.env;

const app = Machinat.createApp({
  modules: [
    Http.initModule({ /* ... */ }),
  ],
  platforms: [
    Telegram.intiModule({
      webhookPath: '/webhook/telegram',
      botName: TELEGRAM_BOT_NAME,
      botToken: TELEGRAM_BOT_TOKEN,
      secretPath: TELEGRAM_SECRET_PATH,
    }),
  ],
});
```
npm package: @machinat/twitter
Description: Twitter platform of Machinat.js
Author: Patrick Liu
Latest version: 0.6.0

# Twitter Platform

Tweeting and direct messaging on [Twitter](https://twitter.com).

## Install

```bash
npm install @machinat/core @machinat/http @machinat/twitter
# or with yarn
yarn add @machinat/core @machinat/http @machinat/twitter
```

## Docs

Check the [platform document](https://machinat.com/docs/twitter-platform)
and the [package reference](https://machinat.com/api/modules/twitter.html).

## Setup

```ts
import Machinat from '@machinat/core';
import Http from '@machinat/http';
import Twitter from '@machinat/twitter';

const {
} = process.env;

const app = Machinat.createApp({
  modules: [
    Http.initModule({ /* ... */ }),
  ],
  platforms: [
    Twitter.intiModule({
      entryPath: '/webhook/twitter',
    }),
  ],
});
```
npm package: @machinat/typedoc-plugin-monorepo
Description: Optimize Typedoc documentation output for libraries that are organized in a monorepo.
Author: Hendrik Liebau
Latest version: 0.3.2-1

## @strictsoftware/typedoc-plugin-monorepo

### What

A plugin for [Typedoc](http://typedoc.org)

When trying to unify documentation for multiple modules residing inside a shared source repository, the default way Typedoc assignes top-level module names might not satisfy.

This plugin allows you to specify a regular expression with a capture group. This is then used to collect related items into one module.

This plugin is inspired by, and based on, [asgerjensen/typedoc-plugin-external-module-map](https://github.com/asgerjensen/typedoc-plugin-external-module-map). However, this plugin will automagically rename top-level modules discovered to a new "Package" type, and auto-discover and display READMEs for the individual packages. Furthermore, these packages are used as top-level entries in the table of contents.

This plugin is intended for monorepos that deliver more than one NPM package in a single Git repository.

Suppose you have
```
packages/@namespace/package-1/index.ts
packages/@namespace/package-1/src/otherfiles.ts
packages/@namespace/package-2/index.ts
packages/@namespace/package-2/src/otherfiles.ts
```

Typedoc will create four "External Modules", named for each .ts file.

- "@namespace/package-1/index"
- "@namespace/package-1/src/otherfiles"
- "@namespace/package-2/index"
- "@namespace/package-2/src/otherfiles"

This plugin allows each file to specify the Typedoc External Module its code should belong to. If multiple files belong to the same module, they are merged.

This allows more control over the modules that Typedoc generates.
Instead of the four modules above, we could group them into two:

- @namespace/package-1
- @namespace/package-2

In addition to grouping these modules, the plugin will attempt to discover README files in each module root to display with the documented package. In this plugin, top-level typedoc "modules" are renamed to the more semantic name "packages" in generated documentation.

### Installing

Typedoc >=0.11 has the ability to discover and load typedoc plugins found in node_modules.
Simply install the plugin and run typedoc.

```
npm install --save @strictsoftware/typedoc-plugin-monorepo
typedoc
```

### Using

This plugin adds a new input option
```
--external-modulemap  ".*packages\/(@namespace\/[^\/]+)\/.*"
```

If you specify it from the command line, be sure to escape the input string so bash doesn't expand it.

It is probably easier to create a typedoc options file (typedoc.json) and add it there:

```
{
  "name": "My Library",
  "mode": "modules",
  "out": "doc",
  "theme": "default",
  "ignoreCompilerErrors": "false",
  "preserveConstEnums": "true",
  "exclude": "*.spec.ts",
  "external-modulemap": ".*packages\/(@namespace\/[^\/]+)\/.*",
  "stripInternal": "false"
}
```
npm package: @machinat/websocket
Description: This package is an underlying module of webview platform for serving WebSocket. You might want to use [`@machinat/webview`](https://github.com/machinat/machinat/tree/master/packages/webview) unless you want to serve your own web service.
Author: Patrick Liu
Latest version: 0.6.0

# WebSocket Module

This package is an underlying module of webview platform for serving WebSocket.
You might want to use [`@machinat/webview`](https://github.com/machinat/machinat/tree/master/packages/webview)
unless you want to serve your own web service.

## Install

```bash
npm install @machinat/core @machinat/http @machinat/websocket
# or with yarn
yarn add @machinat/core @machinat/http @machinat/websocket
```

## Docs

Check the [package reference](https://machinat.com/api/modules/websocket.html).

## Setup

#### Back-end
```js
import Machinat from '@machinat/core';
import Http from '@machinat/http';
import WebSocket from '@machinat/websocket';

const DEV = process.env.NODE_ENV !== 'production';

const app = Machinat.createApp({
  modules: [
    Http.initModule({ /* ... */ }),
  ],
  platforms: [
    WebSocket.initModule({ entryPath: '/websocket' }),
  ],
  service: [
    { // same origin policy
      provide: WebSocket.UpgradeVerifier,
      withValue: ({ headers }) => headers.origin === 'https://your.domain.com',
    },
  ]
}).onEvent(async ({ bot, event }) => {
  // send a event when a connection is open
  if (event.type === 'connect') {
    await bot.send({
      category: 'greeting',
      type: 'hello',
      payload: 'world',
    });
  }
});
```

#### Front-end

```js
import Client from '@machinat/websocket/client';

const client = new Client({ url: '/websocket' });

client.onEvent(async ({ event }) => {
  if (event.type === 'hello') {
    await client.send({
      category: 'greeting',
      type: 'hello',
      payload: 'websocket',
    });
  }
});
```
npm package: @machinat/x-machinat
Description: Reactive programming library for Machinat.js
Author: Patrick Liu
Latest version: 0.2.0-5

# X-Machinat

**_Warning: This package is on experimental, the API might frequently change without backward compatibility. Please evaluate the risk before using it on production._**

## Install

```sh
npm install @machinat/x-machinat
# or with yarn
yarn add @machinat/x-machinat
```

## Usage

```js
import { fromApp, conditions, merge } from 'x-machinat';
import { map, filter } from 'x-machinat/operators';

const event$ = fromApp(app);

const [postback$, textMsg$, unknownMsg$] = conditions(events$, [
  isPostback,
  isText,
  () => true,
]);

const intendedMsg$ = textMsg$.pipe(map(recognizeIntent));

const action$ = merge(
  postback$.pipe(
    map(actionFromPostback)
  ),
  intendedMsg$.pipe(
    filter(isAction),
    map(actionFromIntent)
  )
);

action$.pipe(
  map(executeAction),
  map(replyResult)
);

merge(
  unknownMsg$,
  intendedMsg$.filter(not(isAction))
).pipe(map(replyRandomEmoji));
```

## API

WIP.