open-index/open-npm huggingface dataset:
npm package: @rxse/webtestit-lint-rules
Description: A collection of lint rules recommended for Ranorex Webtestit projects
Author: Ranorex GmbH
Latest version: 1.0.0

# Ranorex Webtestit lint rules

A collection of tslint rules used for [Ranorex Webtestit](https://www.ranorex.com/webtestit) projects

## Rules

* `protractor-no-identical-title-rule` : Prohibits the use of duplicate it/describe names

> This is used to ensure protractor's `--grep` cli parameter gets a unique full testname

## License
This project is licensed under the MIT License.
npm package: @rxstack/channels
Description: RxStack Channels Component
Author: Nikolay Georgiev
Latest version: 0.2.0

# The RxStack Channels

> With channels component you'll be able to create channels, add/remove connections (instance of `EventEmitter`) 
and send messages. The component is intended to be used with socketio or any other realtime framework.
 
Some examples where channels are used:

- Real-time events should only be sent to authenticated users
- Users should only get updates about messages if they joined a certain chat room
- Only users in the same organization should receive real-time updates about their data changes
- Only admins should be notified when new users are created


## Installation

`npm install @rxstack/channels --save`

## Usage

* [Channel manager](#channel-manager)
* [Channels](#channels)
* [Connections](#connections)

### <a name="channel-manager"></a> Channel manager
The channel manager is responsible for creating, merging and destroying channels.

```typescript
// instance of channel manager
const channelManager = new ChannelManager();
// gets or creates a channel if does not exist
const adminsChannel = channelManager.channels('admins');
// or gets or creates merged channels, name of the merge channel would be admins_moderators
const mergeChannels = channelManager.channels('admins', 'moderators');
// destroys the channel
channelManager.removeChannel('admins');
// destroys merged channel
channelManager.removeChannel('admins_moderators');
// destroys all channels
channelManager.reset();
```

### <a name="channels"></a> Channels
A channel is an object that contains a number of connections. 
It can be created via `channel manager` and allows a connection to join or leave it.

```typescript
// ...

// gets or creates a channel if does not exist
const adminsChannel = channelManager.channels('admins');
// a connection
const connection = new EventEmitter();
// joins a channel
adminsChannel.join(connection);
// leaves a channel
adminsChannel.leave(connection);
//  clears all connection
adminsChannel.reset();
```

### <a name="connections"></a> Connections
A connection is an object (`EventEmitter`) that represents a real-time connection. 
It is the same object as socket in a Socket.io. You can add any kind of information to it.


## License

Licensed under the [MIT license](LICENSE).
npm package: @rxstack/configuration
Description: RxStack Configuration Component
Author: Nikolay Georgiev
Latest version: 0.8.0

# The RxStack Configuration

> The Configuration component allows you to load different configuration files depending on node environment.

## Installation

```
npm install @rxstack/configuration --save
```

## Documentation

The `configuration.initialize()` takes up to two options:

1. Path to environment folder directory: `configuration.initialize(process.env.AP_DIR + '/dist/src/configs')`.

2. Files are named `environment.ts` or `environment.testing.ts`. 
You can change the name `configuration.initialize(path_to_dir, 'config')` then it will become `config.ts`

First you need to create `environment.ts` in the `/src/environments` folder. 
Let’s say we want to load different file in production environment 
then we need to create a new file `/src/environments/environment.production.ts`.
The production environment will inherit all configurations from `environment.ts`. 
Under the hood it uses lodash `_.mergeWith` to overwrite configurations.

* [Example](#example)
* [Variable types](#variable-types)
* [Root path](#root-path)


### <a name="example"></a>  Example
In `environments/environment.ts` we want to use the local development environment:

```typescript
export const environment = {
  "host": "localhost",
  "port": 3000,
  "mongodb": "mongodb://localhost:27017/myapp",
};
```

In `environments/environment.production.ts` we are going to use environment variables:

```typescript
export const environment = {
  "host": "MONGO_HOST",
  "port": "MONGO_PORT",
  "mongodb": "MONGOHQ_URL",
};
```

Now it can be used in our `app.ts` like this:

```typescript
import {configuration} from '@rxstack/configuration';
configuration.initialize('./environments');
import {environment} from './environments/environment';

// in development it will return localhost
environment.host
```

### <a name="variable-types"></a> Variable types
`@rxstack/configuration` uses the following variable mechanisms:

- If the value is a valid environment variable (e.v. NODE_ENV), use its value instead
- If the value starts with `./` or `../` turn it into an absolute path relative to the application root path

### <a name="root-path"></a> Root path
You get get root path of your application: `configuration.getRootPath()`

## License

Licensed under the [MIT license](../../LICENSE).
npm package: @rxstack/core
Description: RxStackCore
Author: Nikolay Georgiev
Latest version: 0.8.1

# The RxStack Core

> `@rxstack/core` is set of components which are the backbone of rxstack framework.

## Installation

```
npm install @rxstack/core --save
```

## Documentation

* [Kernel](docs/kernel.md)
* [Application](docs/application.md)
* [Server](docs/server.md)
* [Console](docs/console.md)

## License

Licensed under the [MIT license](LICENSE).
npm package: @rxstack/exceptions
Description: RxStack Exceptions Component
Author: Nikolay Georgiev
Latest version: 0.8.0

# The RxStack Exceptions

> The Exception component contains a set of standard exception classes.
They set the correct HTTP status codes for REST calls and socket responses.

## Installation

```
npm install @rxstack/exceptions --save
```

## Documentation

* [Standard exceptions](#standard-exceptions)
* [Helpers](#helpers)

### <a name="standard-exceptions"></a>  Standard exceptions
The following exception types, all of which are instances of base `Exception` class are available:

- 400: BadRequest
- 401: Unauthorized
- 402: PaymentRequired
- 403: Forbidden
- 404: NotFound
- 405: MethodNotAllowed
- 406: NotAcceptable
- 407: ProxyAuthenticationRequired
- 408: RequestTimeout
- 409: Conflict
- 410: Gone
- 411: LengthRequired
- 412: PreconditionFailed
- 413: PayloadTooLarge
- 414: URITooLong
- 415: UnsupportedMediaType
- 416: Satisfiable
- 417: ExpectationFailed
- 422: UnprocessableEntity
- 429: TooManyRequests
- 451: UnavailableForLegalReasons
- 500: HttpException
- 501: NotImplemented
- 502: BadGateway
- 503: Unavailable
- 507: InsufficientStorage

Exceptions contain the following fields:

- `name`: The error name
- `message`: The error message
- `stack`: The error stack
- `data`: extra data
- `statusCode`: The HTTP status code
- `orginalError`: Original error 

### <a name="helpers"></a> Helpers
To transform a native error to exception, you can use:

```typescript
import {transformToException} from '@rxstack/exceptions'

// returns instance of Exception
transformToException(new Error('ops'));
```

To transform an `Exception` to plain object:

```typescript
import {exceptionToObject, Exception} from '@rxstack/exceptions'

// returns instance of Exception
exceptionToObject(new Exception('Ops'));
```

## License

Licensed under the [MIT license](LICENSE).
npm package: @rxstack/express-file-upload
Description: RxStack ExpressFileUpload Module
Author: Nikolay Georgiev
Latest version: 0.2.0

# RxStack ExpressFileUpload Module

> The ExpressFileUpload module allows you to upload files using [`expressjs`](https://expressjs.com) in rxstack framework.
Under the hood it uses [`formidable`](https://github.com/felixge/node-formidable) and [`mime`](https://github.com/broofa/node-mime)

## Installation

```
npm install @rxstack/express-file-upload --save

// peerDependencies
npm install @rxstack/async-event-dispatcher@^0.2 @rxstack/core@^0.2 @rxstack/exceptions@^0.2 @rxstack/express-server@^0.2 
```

## Documentation

* [Setup](#setup)
* [Module options](#module-options)
* [Controller usage](#controller-usage)

### <a name="setup"></a>  Setup
`ExpressFileUpload` module needs to be registered in the `application`. 
The module depends on [`@rxstack/express-server`](../express-server), 
make sure it is installed and configured.

Let's create the application:

```typescript
import {Application, ApplicationOptions} from '@rxstack/core';
import {ExpressFileUploadModule} from '@rxstack/express-file-upload';

export const APP_OPTIONS: ApplicationOptions = {
  imports: [
    // ...
    ExpressFileUploadModule.configure({
      enabled: true, // default is false
      hash: 'md5', // default is md5
      multiples: false, // default is false
      directory: './uploads' // default is os.tmpdir()
    }),
  ],
  servers: ['express'], 
  providers: [
    // ...
  ], 
  logger: {
    // ....
  }
};

new Application(APP_OPTIONS).start();
```

### <a name="module-options"></a>  Module options
The module accepts the following options:

- `enabled`: whether the module is enabled or not. The default is `false`
- `hash`: If you want checksums calculated for incoming files, set this to either `sha1` or `md5`. The default is `md5`
- `multiples`: If this option is enabled, the files argument will contain arrays of files 
    for inputs which submit multiple files using the HTML5 multiple attribute. The default is `false`
- `directory`: Sets the directory for placing file uploads in. You can move them later on using `fs.rename()`. The default is `os.tmpdir()`.
               

### <a name="controller-usage"></a> Controller usage       
Uploaded file is available in the `Request` object and it is instance of [`File`](../core/src/kernel/models/file.ts)

```typescript
import {Request, Response, Http} from '@rxstack/core';

export class FileUploadController {

  @Http('POST', '/files/upload', 'file_upload')
  async uploadAction(request: Request): Promise<Response> {
    // you can validate it by checking the file.size and file.type
    const file = request.files.get('file'); 
    return new Response(file);
  }
}
```

Here is an `curl` example:

```bash
curl -F 'file=@/path_to_file/hello.txt' http://localhost:3000/files/upload
```

## License

Licensed under the [MIT license](../../LICENSE).
npm package: @rxstack/service-registry
Description: RxStack ServiceRegistry Component
Author: Nikolay Georgiev
Latest version: 0.8.0

# The Service Registry

> Simple registry component useful for all types of applications.

## Installation

```
npm install @rxstack/service-registry --save
```

## Documentation

* [Usage](#usage)
* [Exceptions](#exceptions)

## <a name="usage"></a>  Usage
A registry object acts as a collection of objects. It allows you to store objects which implement a specific interface.

Each service should implement `NamedServiceInterface`:


```typescript
    import {NamedServiceInterface} from '@rxstack/registry';

    export class MyService implements NamedServiceInterface {
      getName(): string {
        return 'service-1';
      }
    }
```

Here we go:

```typescript
    import {ServiceRegistry} from '@rxstack/registry';

    const registry = new ServiceRegistry<MyServiceInterface>();
    registry.register(new MyService1());
    registry.register(new MyService2());
    
    registry.has('service-1'); // should return true
    registry.get('service-1'); // should get service instance
    registry.all(); // should retun an array of all registered service
    registry.reset(); // clears all services from registry
```

Removing a service from the registry is as easy as adding:

```typescript
// ...
registry.unregister('service-1');
registry.has('service-1'); //should return false
```

## <a name="exceptions"></a>  Exceptions

`ExistingServiceException` is thrown when you try to register a service that is already in the registry.

`NonExistingServiceException` is thrown when you try to unregister or get a service which is not in the registry.


## License

Licensed under the [MIT license](LICENSE).
npm package: @rxstack/utils
Description: RxStack Utils Component
Author: Nikolay Georgiev
Latest version: 0.8.0

# The RxStack Utils

> The Utils component is a collection of helpers.

## Installation

```
npm install @rxstack/utils --save
```

## Documentation

* [Parse range](#parse-range)

### <a name="parse-range"></a>  Parse range
Parse the given header string where size is the maximum size of the resource.

```typescript
import {parseRange} from '@rxstack/utils'

parseRange('bytes=0-1023', 10000); 
// output {'start': 0, 'end': 1023, 'chunkSize': 1024}
```

## License

Licensed under the [MIT license](LICENSE).