open-index/open-npm huggingface dataset:
npm package: @meamone/mediatorts
Description: A simple mediator
Author: SamWarden
Latest version: 0.0.3

# Mediatorts

A simple mediator to send requests and publish events


### Example

```ts
import {Handler, IocFactory, MediatorFactory, Request} from "@meamone/mediatorts"

class GetUserById implements Request<string> {
  constructor(
    public readonly userId: number,
  ) {}
}

class GetUserByIdHandler implements Handler<GetUserById, string> {
  constructor(
    private readonly users: {[key: number]: string},
  ) {}

  async handle(request: GetUserById): Promise<string> {
    return this.users[request.userId]
  }
}

async function main() {
  const iocFactory = new IocFactory()
  iocFactory.register(GetUserByIdHandler, async (ctx, callback) => callback(new GetUserByIdHandler({1: "Jack Bolt"})))
  const mediatorFactory = new MediatorFactory()
  mediatorFactory.registerRequest(GetUserById, GetUserByIdHandler)
  await iocFactory.createIoc(async (ioc) => {
    const mediator = mediatorFactory.createMediator(ioc)
    const result = await mediator.send(new GetUserById(1))
    console.log("Result:", result)  // "Result: Jack Bolt"
  }, {})
}

main()
```
npm package: @mean-expert/loopback-component-realtime
Description: The LoopBack Component that turns this great framework into a powerful real-time platform
Author: Jonathan Casarrubias
Latest version: 1.0.2


# LoopBack Component Real-Time

A [LoopBack Framework](http://loopback.io) Component that provides publish events over WebSockets.

This module will supersedes the [LoopBack Component PubSub](https://github.com/mean-expert-official/loopback-component-pubsub) and implements the new [FireLoop Module](http://fireloop.io).

# Installation

````sh
$ npm install --save @mean-expert/{loopback-sdk-builder,loopback-component-realtime}
````

# Setup Back End Module

Update the  `server/component-config.json` as follows:

````json
{
  "loopback-component-explorer": {
    "mountPath": "/explorer"
  },
  "@mean-expert/loopback-component-realtime": {
    "debug": true,
    "auth": true,
    "driver": {
      "name": "socket.io"
    }
  }
}

````

Update the  `server/model-config.json` as follows:

````json
{
    "mixins": [
        "loopback/common/mixins",
        "loopback/server/mixins",
        "../common/mixins",
        "./mixins",
        "../node_modules/@mean-expert/loopback-component-realtime/dist/mixins"
    ]
}
````

# Enable Model to use FireLoop API

From version `1.0.0-rc.8` you need to specify in which models you want to enable FireLoop events to be sent.

>Explanation: In an attempt to enable server and rest triggered events a new mixin has been introduced, this will trigger events either from REST calls or from the NodeJS Api e.g. Model.create().

`NOTE: Due a LoopBack limitation the server triggered events are only available for root model methods (Model.create()), but it won't work for relationship methods, these will continue being executed only from FireLoop Child References in the Front-End`

````json
{
  "mixins": {
    "FireLoop": true
  }
}
````

# Update Server
To propagate the App from LoopBack to FireLoop, so to finalize just update the file `server/server.js` by editing the `app.start` method as follow:

````js
app.start = function() {
  // start the web server
  var server = app.listen(function() {
    app.emit('started', server);
    var baseUrl = app.get('url').replace(/\/$/, '');
    console.log('Web server listening at: %s', baseUrl);
    if (app.get('loopback-component-explorer')) {
      var explorerPath = app.get('loopback-component-explorer').mountPath;
      console.log('Browse your REST API at %s%s', baseUrl, explorerPath);
    }
  });
  return server;
};
````


# PRESENTING FIRELOOP.IO (NEW)
[![FireLoop.io](https://storage.googleapis.com/mean-expert-images/fireloop-logo.png)](https://github.com/mean-expert-official/fireloop.io/wiki)

# Generate FireLoop Angular 2 Client
FireLoop Client for Angular 2 Applications are built in when generating your LoopBack SDK. Read the [Following Instructions](https://github.com/mean-expert-official/loopback-sdk-builder/wiki/1.-Install-Builder-&-Build-SDK) in order to automatically generate your software development kit.
npm package: @mean-expert/openapi-sdk-builder
Description: Tool for auto-generating SDKs from an OpenApi Specification File
Author: Jonathan Casarrubias
Latest version: 1.0.0-alpha.1

OPENAPI SDK BUILDER (ALPHA VERSION)
============================

The [openapi-sdk-builder] is a tool created to help you to automatically build an [Angular] software development kit from an [OpenAPI Specification] file.  

# Installation

````sh
$ npm install -g @mean-expert/openapi-sdk-builder
````

# Contributors

Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
| [<img src="https://avatars0.githubusercontent.com/u/1533239?v=3" width="100px;"/><br /><sub>Jonathan Casarrubias</sub>](http://mean.expert/)<br />[💻](https://github.com/mean-expert-official/fireloop.io/commits?author=jonathan-casarrubias) |
| :---:  |
<!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!

# License
MIT


[Angular]: http://angular.io
[openapi-sdk-builder]: https://github.com/mean-expert-official/openapi-sdk-builder
[OpenAPI Specification]: https://github.com/OAI/OpenAPI-Specification
npm package: @mean-expert/protoc-ts
Description: Protoc compiler plugin for TypeScript service interfaces
Author: Jonathan Casarrubias
Latest version: 0.0.2

# protoc-ts
> Protoc compiler for TypeScript service interfaces

## Installation

````sh
$ npm install --save @mean-expert/protoc-ts
````

## Usage
* Make sure the protoc compiler is installed. [Compiler Releases](https://github.com/google/protobuf/releases/tag/v3.5.0)
* Invoke `protoc` with:
* `--plugin` - define where the plugin needed for `ts_out` can be found
* `--ts_out` - the params and directory to output to 
* `generated` - output directory name
* `-I` - Protos root directory

```sh
protoc \
--plugin=protoc-ts=./node_modules/.bin/protoc-ts \
--ts_out=service=true:generated \
-I ./proto \
proto/*.proto
```