open-index/open-npm huggingface dataset:
npm package: @simtopy/moleculer-simple-runner
Description: A simple runner for moleculer, purposed to run within containers and for testing multi-process environment
Author: Lucas E. VINCENT
Latest version: 1.0.7

# moleculer-simple-runner

A simple runner for **moleculer**, designed to easily test applications in a **multi-process environment** to trooblesoot message brokers and system configuration

## Purpose

We make an intensive use of **moleculer** in our project Simtopy as its design allows flexibility and scalability. To build a strong test policy, we needed to be as close as a real production environment where the microservices are isolated each in their own container, but we still wanted something more lightweight and handy than running containers for integration tests.
Therefore we developped this runner to fit our needs regarding these matters. it allows to isolate each microservice in its own process by using forks.

In addition, we wanted something more lighweight and simple than the full featured moleculer-moleculer to start our service in containers in production environment, so we provided this runner with both a fork and non-fork mode.

## Maintainers

*   Lucas Vincent
*   Ewen Marechal

## Licence

This software is distributed under MIT Licence, feel free to share, modify, fork, reuse of contribute

## Quickstart

### As a standalone process

```bash
npm install moleculer-simple-runner

SERVICES="service1,service2",
SERVICES_DIR="my_services_dir_1:my_services_dir_2"
MOLECULER_REPL_MODE="true" # useful when you start the runner in a dev/pre-prod environment for various audit and testing

run-moleculer
```

### Within a script

```js
import createRunner from "moleculer-simple-runner"

const runnerOptions = {
  SERVICES="service1,service2",
  SERVICES_DIR="my_services_dir_1:my_services_dir_2"
}

// create the broker on the scipt process
let localRunner = await createRunner(runnerOptions)

// create the broker on a forked process
let forkedRunner = await createRunner(runnerOptions, "fork-process-nodeID") // set the second argument to true to used the process pid as a nodeID

// start the broker through the runner api
await localRunner.start()
```

## Configuration

Environement variables / config string :\
MOLECULER_REPL_MODE:\
If set to anything else than a false value, will enter the moleculer repl after the broker start\
SERVICES_DIR:\
One or many directories to search for moleculer services, separated by ":"\
SERVICES :\
whitelist of modules to run, separated by a comma\
EXCLUDED-SERVICES:\\
blacklist of services, separated by a comm\
BROKER_CONFIG: \
path to the broker js config object module\
RUNNER_ENV :\
either a string path to an env file (see dotenv), or a js object to set env variables
RUNNER_ENV_OVERRIDES:\
Overrides the previous env if necessary (when using a base conf + specific conf for services)
npm package: @simtropolis/adapter-base-cache
Description: ## Install
Author: Simtropolis
Latest version: 0.1.3

# Adapter Base Cache

## Install

`npm install @simtropolis/adapter-base-cache --save`

or

`yarn add @simtropolis/adapter-base-cache`

## Usage


## Develop

This is a monorepo package.

Follow the instructions for the top-level repo.
1. `git clone` this repo & `cd` into it as usual
2. Run `yarn` to install top-level dependencies.



## Test

- `yarn lint` run just eslint
- `yarn test` run lint and tests



# Copyright & License 

Copyright (c) 2020-2022 Simtropolis - Released under the [MIT license](LICENSE).
npm package: @simtropolis/admin-api
Description: JavaScript Client Library for the Simtropolis [Admin API](https://simtropolis.org/docs/admin-api/)
Author: Simtropolis
Latest version: 1.13.2

# Admin Api

JavaScript Client Library for the Simtropolis [Admin API](https://simtropolis.org/docs/admin-api/)

## Install

`npm install @simtropolis/admin-api --save`

or

`yarn add @simtropolis/admin-api`


## Usage

See https://simtropolis.org/docs/admin-api/javascript/


## Develop

This is a mono repository, managed with [lerna](https://lerna.js.org/).

Follow the instructions for the top-level repo.
1. `git clone` this repo & `cd` into it as usual
2. Run `yarn` to install top-level dependencies.


## Run

- `yarn dev`


## Test

- `yarn lint` run just eslint
- `yarn test` run lint and tests




# Copyright & License

Copyright (c) 2020-2022 Simtropolis - Released under the [MIT license](LICENSE).
npm package: @simtropolis/admin-api-schema
Description: The package serves as a single source of truth when validating requests coming into Simtropolis's Admin API endpoints. It uses [JSON Schema](https://json-schema.org/) definitions under the hood to describe expected format of validated data.
Author: Simtropolis
Latest version: 4.2.1

# Admin Api Schema

The package serves as a single source of truth when validating requests coming into Simtropolis's Admin API endpoints. It uses [JSON Schema](https://json-schema.org/) definitions under the hood to describe expected format of validated data.

## Install

`npm install @simtropolis/admin-api-schema --save`

or

`yarn add @simtropolis/admin-api-schema`


## Usage
```js
const jsonSchema = require('@simtropolis/admin-api-schema');

// check available schemas
jsonSchema.list()
/*
> [
  'images-upload', 'labels-add',
  'labels-edit',   'members-add',
  'members-edit',  'members-upload',
  'pages-add',     'pages-edit',
  'posts-add',     'posts-edit',
  'tags-add',      'tags-edit',
  'webhooks-add',  'webhooks-edit'
]
*/

// get schema definition
jsonSchema.get('tags-edit');
/*
> {
  '$schema': 'http://json-schema.org/draft-07/schema#',
  '$id': 'tags.edit',
  title: 'tags.edit',
  description: 'Schema for tags.edit',
  type: 'object',
  additionalProperties: false,
  properties: {
    tags: { type: 'array', minItems: 1, maxItems: 1, items: [Object] }
  },
  required: [ 'tags' ]
}
*/

// validate data
const data = {
    posts: [{
        title: 'valid'
    }]
};

try {
    await apiSchema.validate({data, schema: 'posts-add'});
} catch (err) {
    console.log('validateion error:', err);
}
```

When used from Simtropolis core in validation layer:
```js
const jsonSchema = require('@simtropolis/admin-api-schema');
const validate = async (apiConfig, frame) => await jsonSchema.validate({
    data: frame.data,
    schema: `${apiConfig.docName}-${apiConfig.method}`
});
```

## Develop

This is a mono repository, managed with [lerna](https://lernajs.io/).

Follow the instructions for the top-level repo.
1. `git clone` this repo & `cd` into it as usual
2. Run `yarn` to install top-level dependencies.


## Run

- `yarn dev`


## Test

- `yarn lint` run just eslint
- `yarn test` run lint and tests




# Copyright & License

Copyright (c) 2020-2022 Simtropolis - Released under the [MIT license](LICENSE).
npm package: @simtropolis/bookshelf-collision
Description: ## Install
Author: Simtropolis
Latest version: 0.1.30

# Bookshelf Collision

## Install

`npm install @simtropolis/bookshelf-collision --save`

or

`yarn add @simtropolis/bookshelf-collision`


## Usage


## Develop

This is a mono repository, managed with [lerna](https://lernajs.io/).

Follow the instructions for the top-level repo.
1. `git clone` this repo & `cd` into it as usual
2. Run `yarn` to install top-level dependencies.


## Run

- `yarn dev`


## Test

- `yarn lint` run just eslint
- `yarn test` run lint and tests




# Copyright & License 

Copyright (c) 2020-2022 Simtropolis - Released under the [MIT license](LICENSE).
npm package: @simtropolis/bookshelf-custom-query
Description: ## Install
Author: Simtropolis
Latest version: 0.1.17

# Bookshelf Custom Query

## Install

`npm install @simtropolis/bookshelf-custom-query --save`

or

`yarn add @simtropolis/bookshelf-custom-query`


## Usage


## Develop

This is a mono repository, managed with [lerna](https://lernajs.io/).

Follow the instructions for the top-level repo.
1. `git clone` this repo & `cd` into it as usual
2. Run `yarn` to install top-level dependencies.


## Run

- `yarn dev`


## Test

- `yarn lint` run just eslint
- `yarn test` run lint and tests




# Copyright & License 

Copyright (c) 2020-2022 Simtropolis - Released under the [MIT license](LICENSE).
npm package: @simtropolis/bookshelf-eager-load
Description: ## Install
Author: Simtropolis
Latest version: 0.1.20

# Bookshelf Eager Load

## Install

`npm install @simtropolis/bookshelf-eager-load --save`

or

`yarn add @simtropolis/bookshelf-eager-load`


## Usage


## Develop

This is a mono repository, managed with [lerna](https://lernajs.io/).

Follow the instructions for the top-level repo.
1. `git clone` this repo & `cd` into it as usual
2. Run `yarn` to install top-level dependencies.


## Run

- `yarn dev`


## Test

- `yarn lint` run just eslint
- `yarn test` run lint and tests




# Copyright & License 

Copyright (c) 2020-2022 Simtropolis - Released under the [MIT license](LICENSE).
npm package: @simtropolis/bookshelf-filter
Description: ## Install
Author: Simtropolis
Latest version: 0.5.2

# Bookshelf Filter

## Install

`npm install @simtropolis/bookshelf-filter --save`

or

`yarn add @simtropolis/bookshelf-filter`


## Usage


## Develop

This is a mono repository, managed with [lerna](https://lernajs.io/).

Follow the instructions for the top-level repo.
1. `git clone` this repo & `cd` into it as usual
2. Run `yarn` to install top-level dependencies.


## Run

- `yarn dev`


## Test

- `yarn lint` run just eslint
- `yarn test` run lint and tests




# Copyright & License 

Copyright (c) 2020-2022 Simtropolis - Released under the [MIT license](LICENSE).
npm package: @simtropolis/bookshelf-has-posts
Description: ## Install
Author: Simtropolis
Latest version: 0.1.21

# Bookshelf Has Posts

## Install

`npm install @simtropolis/bookshelf-has-posts --save`

or

`yarn add @simtropolis/bookshelf-has-posts`


## Usage


## Develop

This is a mono repository, managed with [lerna](https://lernajs.io/).

Follow the instructions for the top-level repo.
1. `git clone` this repo & `cd` into it as usual
2. Run `yarn` to install top-level dependencies.


## Run

- `yarn dev`


## Test

- `yarn lint` run just eslint
- `yarn test` run lint and tests




# Copyright & License 

Copyright (c) 2020-2022 Simtropolis - Released under the [MIT license](LICENSE).
npm package: @simtropolis/bookshelf-include-count
Description: ## Install
Author: Simtropolis
Latest version: 0.3.3

# Bookshelf Include Count

## Install

`npm install @simtropolis/bookshelf-include-count --save`

or

`yarn add @simtropolis/bookshelf-include-count`


## Usage


## Develop

This is a mono repository, managed with [lerna](https://lernajs.io/).

Follow the instructions for the top-level repo.
1. `git clone` this repo & `cd` into it as usual
2. Run `yarn` to install top-level dependencies.


## Run

- `yarn dev`


## Test

- `yarn lint` run just eslint
- `yarn test` run lint and tests




# Copyright & License 

Copyright (c) 2020-2022 Simtropolis - Released under the [MIT license](LICENSE).
npm package: @simtropolis/bookshelf-order
Description: ## Install
Author: Simtropolis
Latest version: 0.1.17

# Bookshelf Order

## Install

`npm install @simtropolis/bookshelf-order --save`

or

`yarn add @simtropolis/bookshelf-order`


## Usage


## Develop

This is a mono repository, managed with [lerna](https://lernajs.io/).

Follow the instructions for the top-level repo.
1. `git clone` this repo & `cd` into it as usual
2. Run `yarn` to install top-level dependencies.


## Run

- `yarn dev`


## Test

- `yarn lint` run just eslint
- `yarn test` run lint and tests




# Copyright & License 

Copyright (c) 2020-2022 Simtropolis - Released under the [MIT license](LICENSE).
npm package: @simtropolis/bookshelf-pagination
Description: ## Install
Author: Simtropolis
Latest version: 0.1.33

# Bookshelf Pagination

## Install

`npm install @simtropolis/bookshelf-pagination --save`

or

`yarn add @simtropolis/bookshelf-pagination`


## Usage


## Develop

This is a mono repository, managed with [lerna](https://lernajs.io/).

Follow the instructions for the top-level repo.
1. `git clone` this repo & `cd` into it as usual
2. Run `yarn` to install top-level dependencies.


## Run

- `yarn dev`


## Test

- `yarn lint` run just eslint
- `yarn test` run lint and tests




# Copyright & License 

Copyright (c) 2020-2022 Simtropolis - Released under the [MIT license](LICENSE).
npm package: @simtropolis/bookshelf-plugins
Description: ## Install
Author: Simtropolis
Latest version: 0.6.3

# Bookshelf Plugins

## Install

`npm install @simtropolis/bookshelf-plugins --save`

or

`yarn add @simtropolis/bookshelf-plugins`


## Usage


## Develop

This is a mono repository, managed with [lerna](https://lernajs.io/).

Follow the instructions for the top-level repo.
1. `git clone` this repo & `cd` into it as usual
2. Run `yarn` to install top-level dependencies.


## Run

- `yarn dev`


## Test

- `yarn lint` run just eslint
- `yarn test` run lint and tests




# Copyright & License 

Copyright (c) 2020-2022 Simtropolis - Released under the [MIT license](LICENSE).
npm package: @simtropolis/bookshelf-search
Description: ## Install
Author: Simtropolis
Latest version: 0.1.17

# Bookshelf Search

## Install

`npm install @simtropolis/bookshelf-search --save`

or

`yarn add @simtropolis/bookshelf-search`


## Usage


## Develop

This is a mono repository, managed with [lerna](https://lernajs.io/).

Follow the instructions for the top-level repo.
1. `git clone` this repo & `cd` into it as usual
2. Run `yarn` to install top-level dependencies.


## Run

- `yarn dev`


## Test

- `yarn lint` run just eslint
- `yarn test` run lint and tests




# Copyright & License 

Copyright (c) 2020-2022 Simtropolis - Released under the [MIT license](LICENSE).
npm package: @simtropolis/bookshelf-transaction-events
Description: ## Install
Author: Simtropolis
Latest version: 0.2.2

# Bookshelf Transaction Events

## Install

`npm install @simtropolis/bookshelf-transaction-events --save`

or

`yarn add @simtropolis/bookshelf-transaction-events`


## Usage


## Develop

This is a mono repository, managed with [lerna](https://lernajs.io/).

Follow the instructions for the top-level repo.
1. `git clone` this repo & `cd` into it as usual
2. Run `yarn` to install top-level dependencies.


## Run

- `yarn dev`


## Test

- `yarn lint` run just eslint
- `yarn test` run lint and tests




# Copyright & License 

Copyright (c) 2020-2022 Simtropolis - Released under the [MIT license](LICENSE).
npm package: @simtropolis/bunyan-rotating-filestream
Description: ## Install
Author: Simtropolis
Latest version: 0.0.7

# Bunyan Rotating Filestream

## Install

`npm install @simtropolis/bunyan-rotating-filestream --save`

or

`yarn add @simtropolis/bunyan-rotating-filestream`


## Usage

Create a bunyan logger using the stream:

```js
    var log = bunyan.createLogger({
        name: 'foo',
        streams: [{
            stream: new RotatingFileStream({
                path: '/var/log/foo.log',
                period: '1d',          // daily rotation
                totalFiles: 10,        // keep up to 10 backup copies
                rotateExisting: true,  // Give ourselves a clean file when we start up, based on period
                threshold: '10m',      // Rotate log files larger than 10 megabytes
                totalSize: '20m',      // Don't keep more than 20mb of archived log files
                gzip: true             // Compress the archive log files to save space
            })
        }]
    });
```

Other options include `startNewFile` to always open a new file on start-up.

## Develop

1. `git clone` this repo & `cd` into it as usual
2. Run `yarn` to install top-level dependencies.

## Test

- `yarn lint` run just eslint
- `yarn test` run lint and tests


## Publish

- `yarn ship`

## Credit

Many thanks to @Rcomian for their work on the original bunyan-rotating-file-stream project, this project borrows lots of the code and all of the ideas in the original.

# Copyright & License 

Copyright (c) 2020-2022 Simtropolis - Released under the [MIT license](LICENSE).
npm package: @simtropolis/color-utils
Description: ## Install
Author: Simtropolis
Latest version: 0.1.22

# Color Utils

## Install

`npm install @simtropolis/color-utils --save`

or

`yarn add @simtropolis/color-utils`


## Usage


## Develop

This is a mono repository, managed with [lerna](https://lernajs.io/).

Follow the instructions for the top-level repo.
1. `git clone` this repo & `cd` into it as usual
2. Run `yarn` to install top-level dependencies.


## Run

- `yarn dev`


## Test

- `yarn lint` run just eslint
- `yarn test` run lint and tests




# Copyright & License 

Copyright (c) 2020-2022 Simtropolis - Released under the [MIT license](LICENSE).
npm package: @simtropolis/config
Description: ## Install
Author: Simtropolis
Latest version: 0.2.14

# Config

## Install

`npm install @simtropolis/config --save`

or

`yarn add @simtropolis/config`


## Usage


## Develop

This is a mono repository, managed with [lerna](https://lernajs.io/).

Follow the instructions for the top-level repo.
1. `git clone` this repo & `cd` into it as usual
2. Run `yarn` to install top-level dependencies.


## Run

- `yarn dev`


## Test

- `yarn lint` run just eslint
- `yarn test` run lint and tests




# Copyright & License 

Copyright (c) 2020-2022 Simtropolis - Released under the [MIT license](LICENSE).
npm package: @simtropolis/config-url-helpers
Description: ## Install
Author: Simtropolis
Latest version: 1.0.4

# Config Url Helpers

## Install

`npm install @simtropolis/config-url-helpers --save`

or

`yarn add @simtropolis/config-url-helpers`


## Usage


## Develop

This is a mono repository, managed with [lerna](https://lernajs.io/).

Follow the instructions for the top-level repo.
1. `git clone` this repo & `cd` into it as usual
2. Run `yarn` to install top-level dependencies.


## Run

- `yarn dev`


## Test

- `yarn lint` run just eslint
- `yarn test` run lint and tests




# Copyright & License 

Copyright (c) 2020-2022 Simtropolis - Released under the [MIT license](LICENSE).
npm package: @simtropolis/content-api
Description: JavaScript Client Library for the Simtropolis [Content API](https://simtropolis.org/docs/content-api/)
Author: Simtropolis
Latest version: 1.11.5

# Simtropolis Content API

JavaScript Client Library for the Simtropolis [Content API](https://simtropolis.org/docs/content-api/)


## Usage

See https://simtropolis.org/docs/content-api/javascript/

## Develop

This is a mono repository, managed with [lerna](https://lernajs.io/).

Follow the instructions for the top-level repo.
1. `git clone` this repo & `cd` into it as usual
2. Run `yarn` to install top-level dependencies.


# Copyright & License

Copyright (c) 2020-2022 Simtropolis - Released under the [MIT license](LICENSE).
npm package: @simtropolis/database-info
Description: `@simtropolis/database-info` is a small utility for `knex` that returns information on the underlying DB connection.
Author: Simtropolis
Latest version: 0.3.14

# Database Info

`@simtropolis/database-info` is a small utility for `knex` that returns information on the underlying DB connection.

It currently works with SQLite, MySQL 5 & 8, and MariaDB.

## Install

`npm install @simtropolis/database-info --save`

or

`yarn add @simtropolis/database-info`


## Usage


## Develop

This is a mono repository, managed with [lerna](https://lernajs.io/).

Follow the instructions for the top-level repo.
1. `git clone` this repo & `cd` into it as usual
2. Run `yarn` to install top-level dependencies.


## Run

- `yarn dev`


## Test

- `yarn lint` run just eslint
- `yarn test` run lint and tests




# Copyright & License 

Copyright (c) 2020-2022 Simtropolis - Released under the [MIT license](LICENSE).
npm package: @simtropolis/debug
Description: ## Install
Author: Simtropolis
Latest version: 0.1.21

# Debug

## Install

`npm install @simtropolis/debug --save`

or

`yarn add @simtropolis/debug`


## Usage


## Develop

This is a mono repository, managed with [lerna](https://lernajs.io/).

Follow the instructions for the top-level repo.
1. `git clone` this repo & `cd` into it as usual
2. Run `yarn` to install top-level dependencies.


## Run

- `yarn dev`


## Test

- `yarn lint` run just eslint
- `yarn test` run lint and tests




# Copyright & License 

Copyright (c) 2020-2022 Simtropolis - Released under the [MIT license](LICENSE).
npm package: @simtropolis/elasticsearch
Description: ## Install
Author: Simtropolis
Latest version: 3.0.9

# Elasticsearch

## Install

`npm install @simtropolis/elasticsearch --save`

or

`yarn add @simtropolis/elasticsearch`


## Usage


## Develop

This is a mono repository, managed with [lerna](https://lernajs.io/).

Follow the instructions for the top-level repo.
1. `git clone` this repo & `cd` into it as usual
2. Run `yarn` to install top-level dependencies.


## Run

- `yarn dev`


## Test

- `yarn lint` run just eslint
- `yarn test` run lint and tests



# Copyright & License 

Copyright (c) 2020-2022 Simtropolis - Released under the [MIT license](LICENSE).
npm package: @simtropolis/errors
Description: ## Install
Author: Simtropolis
Latest version: 1.2.20

# Errors

## Install

`npm install @simtropolis/errors --save`

or

`yarn add @simtropolis/errors`


## Usage


## Develop

This is a mono repository, managed with [lerna](https://lernajs.io/).

Follow the instructions for the top-level repo.
1. `git clone` this repo & `cd` into it as usual
2. Run `yarn` to install top-level dependencies.


## Run

- `yarn dev`


## Test

- `yarn lint` run just eslint
- `yarn test` run lint and tests




# Copyright & License

Copyright (c) 2020-2022 Simtropolis - Released under the [MIT license](LICENSE).
npm package: @simtropolis/express-test
Description: Rapid express testing without HTTP
Author: Simtropolis
Latest version: 0.11.8

# Express Test

Rapid express testing without HTTP

## Install

`npm install @simtropolis/express-test --save`

or

`yarn add @simtropolis/express-test`


## Usage

```
const TestAgent = require('@simtropolis/express-test');
const agent = new TestAgent(app, {defaults});
```

For the most up-to-date and clear usage info, there's a live working example of this library in action inside `tests/example-app.test.js`.

An instantiated agent can make HTTP-like calls, with a supertest-like chained API to set headers & body and to check status, headers and anything else.


```
const agent = new TestAgent(app)

return await agent
    .post('/check/')
    .header('x-check', true) // set a header
    .body({foo: 'bar'}) // Set the body of the POST
    .expectStatus(200) // Assert that the response status is 200
    .expectHeader('x-checked', 'false') // Assert a header is set on the response
    .expect(({body}) => {
        // Make any further assertions
        assert.deepEqual(body, {foo: 'bar'});
    });
```
This is an initial version for review. More docs coming if it works :)


### Assertion execution order
The order of *chained* assertion execution is NOT the order they were declared in. The framework follows the priority order of the assertion types:
1. `expect`
2. `expectHeader`
3. `expectStatus`

Meaning, any `expect` declarations would be asserted first following by `expectHeader` and `expectStatus` declarations.

The custom order is here to prioritize assertions with the most context first. The feature was added based on frustrations with frameworks like [superagent](https://github.com/visionmedia/superagent), which didn't provide enough information when the status code assertions failed.

## Develop

This is a mono repository, managed with [lerna](https://lernajs.io/).

Follow the instructions for the top-level repo.
1. `git clone` this repo & `cd` into it as usual
2. Run `yarn` to install top-level dependencies.


## Run

- `yarn dev`


## Test

- `yarn lint` run just eslint
- `yarn test` run lint and tests




# Copyright & License

Copyright (c) 2020-2022 Simtropolis - Released under the [MIT license](LICENSE).