open-index/open-npm huggingface dataset:
npm package: @sameke/bunyan-log
Description: Logger class based on node-bunyan-logger which defaults most commonly used logger settings.
Author: weagle08
Latest version: 3.0.2

# bunyan-log

Simple wrapper around bunyan which sets many common defaults.
**REQUIRES ECMAScript6 friendly node version**

##install

$npm install bunyan-log

##usage

```javascript
var Logger = require('bunyan-log');

var log = new Logger({name: 'myLogger'});
log.debug('hi, my name is ben.');
```

**constructor**  
``` var log = new Logger([options])```  
See [node-bunyan](https://github.com/trentm/node-bunyan) for options that can be set.  

* logging to stdout: ```options.useStdOut = true;```
* not logging to file: ```options.useFile = false;```
* allowing logging to new log file on cluster.fork'd process: ```options.isNewProcess = true```
* allow process created with child_process.fork to send to parent: ```options.sendToParent = true```
* default path for logs is [root]/logs directory
npm package: @sameke/expressjs-decorators
Description: express decorators
Author: weagle08
Latest version: 1.1.19

# expressjs-decorators
express decorators

## overview

This is a convience library to make creating routes for express REST services cleaner.

## getting started

>*$ npm install expressjs-decorators

---

1. Create models, business logic and any data access classes required

UserService.ts
```typescript
import {UserRepository} from '../repositories/UserRepository';

export class UserService {
    private _userRepository: UserRepository;

    constructor(userRepository: UserRepository) {
        this._userRepository = userRepository;
    }

    public async getUser(id: number): Promise<User> {
        let user = await this._userRepository.getUser(id);
        return user;
    }
}

```

2. Create your REST API

UserController.ts
```typescript
import {UserService} from '../services/UserService';
import {Response as ExpressResponse} from 'express';
import {Controller, Get, CatchAndSendError, Response, NumParam} from 'expressjs-decorators';

@Controller('/users')
export class UserController {
    private _userService: UserService;

    constructor(userService: UserService) {
        this._userService = userService;
    }

    @CatchAndSendError()
    @Get('/:userId')
    public async getUser(@Response() res: ExpressResponse, @NumParam('userId') id: number): Promise<void> {
        let user = await this._userService.getUser(id);
        res.location(`/api/users/${user.id}`);
        res.json({user: user});
    }
}

```

3. Set up dependency injection container and start an HTTP listener

index.ts  
```typescript
import {registerController} from 'expressjs-decorators';
import * as express from 'express';
import {Router} from 'express';
import {UserController} from './controllers/UserController';

// create express application
const app: express.Application = express();

const apiRouter = Router();

let userRepo = new UserRepository();

let userController = new UserController(new UserService(userRepo));

// register controllers
registerController(apiRouter, userController);

app.use('/api', apiRouter);

// run http listener
const server: Server = app.listen(8080, (error: Error) => {
    if (error != null) {
        console.log(error);
    } else {
        console.log('server listening over insecure http on port 8080');
    }
});
```

4. You should now have a useable api endpoint at:
> localhost:8080/api/users/[id]
npm package: @sameke/object-map-decorators
Description: allows creating simple object maps using decorators
Author: weagle08
Latest version: 1.0.2

# object-map-decorators
allows creating simple object maps using decorators


@MapFrom()
@MapFrom('test')
@MapFrom('test', () => Foo)
@MapFrom((f: Foo) => f.test, () => Foo)
npm package: @sameke/task-container
Description: Node task runner. Allows user to create and run Node tasks in a separate process.
Author: weagle08
Latest version: 3.0.1

# task-container
Node async task runner. Allows user to create and run Node tasks in seperate process.

The child task is simply a module that exports a default function or a function named `run`. See definition for `Task<T,S>`.

# Example

*myTask.ts*
```typescript
export const run: Task<string, boolean> = async (msg: string): Promise<boolean> => {
    console.log(msg);
    return true;
}
```
**or**

*myTask.ts*
```typescript
export async function run(msg: string): Promise<boolean> {
    console.log(msg);
    return true;
}
```

**or**

*myTask.ts*
```typescript
export default async (msg: string) => {
    console.log(msg);
    return true;
};
```
**then**

*main.ts*
```typescript
import {TasContainer} from '@sameke/task-container';
import path from 'path';

(() => {
    let taskPath = path.join(__dirname, './path/to/module/myTask');
    let taskContainer = new TaskContainer();

    let result = await taskContainer.run<string, boolean>(taskPath, 'hello world'); // prints hello word on a child process

    if (result == true) {
        console.log('task passed'); // prints task passed
    } else {
        console.log('task failed');
    }

    taskContainer.dispose();
})();
```

# API
### new TaskContainer([options])
**options**  
```typescript
{
  maxTaskRunners: [number], //default: 1,
  maxCallsPerTaskRunner: [number], //default: Infinity
}
```
  
  * maxTaskRunners  
    
    Number of child processes to spawn for handling tasks. If all child processes are currently busy the task will be queued and handled as soon as a handler is free. Task are processed in FIFO order.
    
  * maxCallsPerTaskRunner
      
    Number of times to call a child task before recycling the process (killing current child process and starting a new one). This can be used to manage memory leaks until they can be fixed.
  
### taskContainer.run(fullPath, [data])
**fullPath**  
  This is the path to the module you wish to run as a task. This script should export a default async function or an async function named run. See above example and type definition for `Task` (`import {Task} from '@sameke/task-container'`).
  
**data**  
  Any object you wish to be passed to the task. Note that only properties can be passed across process, no functions will be retained.