open-index/open-npm huggingface dataset:
npm package: @qiwi/esm
Description: ESM fork with minor tunings for QIWI OSS
Author: John-David Dalton
Latest version: 1.1.8

# @qiwi/esm

[![CI](https://github.com/qiwi-forks/esm/workflows/CI/badge.svg)](https://github.com/qiwi-forks/esm/actions)
![npm (scoped)](https://img.shields.io/npm/v/@qiwi/esm)

Fork of [esm](https://github.com/standard-things/esm) with some useful patches:
* [Adam Thornburn's fix for mixed esm-cjs graphs](https://github.com/qiwi-forks/esm/tree/feature/patch-module-loader-for-mixed-cjs-esm-dependency-graphs)
* [Jonathan Grimes' tweak ups](https://github.com/jsg2021/esm/tree/master)
* added `.cjs` to allowed extensions
* supported `node:`-prefixed modules
* bumped deps, fixed some vulnerabilities

## Usage
### CLI
```shell
node -r @qiwi/esm main.js
```
### JS API
```js
// Set options as a parameter, environment variable, or rc file.
require = require("@qiwi/esm")(module/*, options*/)
module.exports = require("./main.js")
```
https://github.com/standard-things/esm

## License
[MIT](LICENSE)
npm package: @qiwi/event-transmitter
Description: Async adapter to save & deliver reasonable events to some endpoint
Author: Qiwibot
Latest version: 1.19.1

# @qiwi/event-transmitter
> Async adapter to save &amp; deliver reasonable events to some endpoint  

[![CI](https://github.com/qiwi/event-transmitter/workflows/CI/badge.svg)](https://github.com/qiwi/event-transmitter/actions)
[![Maintainability](https://api.codeclimate.com/v1/badges/d72d92ed2e931dacecf9/maintainability)](https://codeclimate.com/github/qiwi/event-transmitter/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/d72d92ed2e931dacecf9/test_coverage)](https://codeclimate.com/github/qiwi/event-transmitter/test_coverage)

## Install
```bash
yarn add @qiwi/event-transmitter
```

## Usage

### FLP integration
```ts
import { createFrontLogProxyTransmitter } from '@qiwi/event-transmitter'

const transmitter = createFrontLogProxyTransmitter({
  appName: 'my-app',
  url: 'https://example.qiwi.com/event'
})

// logger-like interface
transmitter.error(new Error('some error'))
transmitter.info('some-event')
transmitter.debug('debug')
transmitter.warn('warn')
transmitter.trace('trace')
```

### FLP integration with React
```javascript
import { createFrontLogProxyTransmitter } from '@qiwi/event-transmitter'

const transmitter = createFrontLogProxyTransmitter({
  appName: 'my=app',
  url: 'https://example.qiwi.com/event'
})

class ErrorBoundary extends Component {
  public state = {
    hasError: false
  };

  public static getDerivedStateFromError() {
    return { hasError: true };
  }

  public componentDidCatch(error, errorInfo) {
    transmitter.error({message: error, details: {errorInfo}})
  }

  public render() {
    if (this.state.hasError) {
      return <h1>Sorry.. there was an error</h1>;
    }

    return this.props.children;
  }
}
```

### Custom usage
```ts
import {createTransmitter, createHttpPipe, IPipe} from '@qiwi/event-transmitter'

const httpPipe: IPipe = createHttpPipe({
  url: 'https://example.qiwi.com/event',
  method: 'POST'
})

const transmitter = createTransmitter({
  pipeline: [httpPipe]
})
const event: IClientEventDto = {...}

transmitter.push(event)
```
See also [https://github.com/qiwi/flp-njs](https://github.com/qiwi/flp-njs)

## License
[MIT](LICENSE)
npm package: @qiwi/git-sync
Description: Git fetch/push helper
Author: Anton Golub
Latest version: 1.2.4

# @qiwi/git-sync
Git helper to fetch & push dirs. For everything else there is [nodegit](https://github.com/nodegit/nodegit).

## Usage
### JS API
```javascript
import { gitSync } from '@qiwi/git-sync'

// Upload
await gitSync({
  action: 'push',
  from: './docs',
  to: './',
  brach: 'gh-pages',
  url: 'https://https://github.com/some/repo.git',
  env: {
    GIT_TOKEN: 'token'
  }
})

// Download
await gitSync({
  action: 'fetch',
  url: 'https://https://github.com/some/repo.git',
  brach: 'gh-pages',
  from: './',
  to: './docs',
  env: {
    GIT_TOKEN: 'token'
  }
})
```

### CLI
**Fetch** from remote to local:
```shell
GIT_TOKEN='token' gitsync --url='https://https://github.com/some/repo.git' --action='fetch' --from='./' --to='./docs' --branch='gh-pages'
```
the same via ssh:
```shell
GIT_SSH_COMMAND='ssh -i private_key_file -o IdentitiesOnly=yes' gitsync --url='git@github.com:some/repo.git' --action='fetch' --from='./' --to='./docs'
```

**Push** local dir to remote:
```shell
GIT_TOKEN='token' gitsync --action='push' --from='./docs' --to='./' --branch='gh-pages'
```

## License
[MIT](./../../LICENSE)
npm package: @qiwi/git-utils
Description: Common git utils
Author: Anton Golub
Latest version: 1.2.1

# @qiwi/git-utils
Git utils for CI/CD tools.

## Install
```shell script
yarn add @qiwi/git-utils
```

## Usage
```typescript
import { gitTags } from '@qiwi/git-utils'

const tags = await gitTags({ cwd: '/foo/bar/baz', branch: 'master' }) 
```
npm package: @qiwi/json-rpc
Description: JSON RPC 2.0 facade
Author: Anton Golub
Latest version: 1.0.14

# @qiwi/json-rpc
JSON RPC 2.0 Controller

## Install
```bash
yarn add @qiwi/json-rpc
npm add @qiwi/json-rpc
```

## Usage
```typescript
import {
  JsonRpcMiddleware,
  JsonRpcMethod,
  IJsonRpcId,
  IJsonRpcParams
} from '@qiwi/json-rpc'

@JsonRpcMiddleware()
export class SomeJsonRpcMware {
  @JsonRpcMethod('some-method')
  doSomething(@JsonRpcId() id: IJsonRpcId, @JsonRpcParams() params: IJsonRpcParams) {
    const {foo} = params
    
    if (foo === 'bar') {
      return new JsonRpcError(-100, '"foo" param should not be equal "bar"')
    }
    
    return 'ok'
  }
} 

const jsonRpcMware = new SomeJsonRpcMware().middleware

app.use('/rpc', jsonRpcMware)
```

## Specification
[https://www.jsonrpc.org/specification](https://www.jsonrpc.org/specification)
npm package: @qiwi/json-rpc-common
Description: JSON RPC 2.0 common components
Author: Anton Golub
Latest version: 1.1.5

# expressjs-json-rpc
Expressjs JSON RPC 2.0 Controller

## Install
```bash
yarn add expressjs-json-rpc
npm add expressjs-json-rpc
```

## Usage
```typescript
import {
  JsonRpcMiddleware,
  JsonRpcMethod,
  IJsonRpcId,
  IJsonRpcParams
} from 'nestjs-json-rpc'

@JsonRpcMiddleware()
export class SomeJsonRpcMware {
  @JsonRpcMethod('some-method')
  doSomething(@JsonRpcId() id: IJsonRpcId, @JsonRpcParams() params: IJsonRpcParams) {
    const {foo} = params
    
    if (foo === 'bar') {
      return new JsonRpcError(-100, '"foo" param should not be equal "bar"')
    }
    
    return 'ok'
  }
} 

const jsonRpcMware = new SomeJsonRpcMware().middleware

app.use('/rpc', jsonRpcMware)
```

## Specification
[https://www.jsonrpc.org/specification](https://www.jsonrpc.org/specification)
npm package: @qiwi/json-rpc-open-rpc
Description: JSON RPC 2.0 open-rpc describe
Author: Anton Golub
Latest version: 1.1.5

# expressjs-json-rpc
Expressjs JSON RPC 2.0 Controller

## Install
```bash
yarn add expressjs-json-rpc
npm add expressjs-json-rpc
```

## Usage
```typescript
import {
  JsonRpcMiddleware,
  JsonRpcMethod,
  IJsonRpcId,
  IJsonRpcParams
} from 'nestjs-json-rpc'

@JsonRpcMiddleware()
export class SomeJsonRpcMware {
  @JsonRpcMethod('some-method')
  doSomething(@JsonRpcId() id: IJsonRpcId, @JsonRpcParams() params: IJsonRpcParams) {
    const {foo} = params
    
    if (foo === 'bar') {
      return new JsonRpcError(-100, '"foo" param should not be equal "bar"')
    }
    
    return 'ok'
  }
} 

const jsonRpcMware = new SomeJsonRpcMware().middleware

app.use('/rpc', jsonRpcMware)
```

## Specification
[https://www.jsonrpc.org/specification](https://www.jsonrpc.org/specification)
npm package: @qiwi/libdefkit
Description: Util toolset to produce single-file TS and Flow libdefs
Author: QIWI
Latest version: 6.1.4

# @qiwi/libdefkit
[![Maintainability](https://api.codeclimate.com/v1/badges/75f356021f0789f1c38d/maintainability)](https://codeclimate.com/github/qiwi/libdefkit/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/75f356021f0789f1c38d/test_coverage)](https://codeclimate.com/github/qiwi/libdefkit/test_coverage)

> Util toolset to produce single-file TS and Flow libdefs

## Requirements
Node.js >= 16

## Install
```shell script
yarn add @qiwi/libdefkit -D
```

## Usage
Insert script to `package.json`
```json
{
  "scripts": {
    "build:libdef": "libdefkit --tsconfig=tsconfig.esm.json --tsconfig=tsconfig.cjs.json"
  }
}
```

## CLI
| Flag              | Description                                                 | Default                    |            
|-------------------|-------------------------------------------------------------|----------------------------|
| `--help`          | Display usage hints                                         |                            |
| `--cwd`           | Set current working dir                                     | `process.cwd()`            |  
| `--entry`         | Define pkg entry point                                      | `./index.ts`               |
| `--ext`           | Extension to use in module declarations. `''` to unset any. | `.js`                      |        
| `--tsconfig`      | Define path(s) to project's TS config                       |                            |
| `--customTypings` | Attach custom libdefs to d.ts bundle                        |                            |
| `--cache`         | Dir for temporary assets                                    | `tempy.directory()`        |
| `--dtsOut`        | **TS** typings output                                       | `typings/index.d.ts`       |
| `--flowOut`       | **Flow** libdef output                                      | `flow-typed/index.flow.js` |

## License
[MIT](./LICENSE)
npm package: @qiwi/license
Description: QIWI OSS License
Author: QIWI
Latest version: 2.0.3

# QIWI Open Source Software License

[![CI](https://github.com/qiwi/license/actions/workflows/ci.yaml/badge.svg)](https://github.com/qiwi/license/actions/workflows/ci.yaml)
[![Maintainability](https://api.codeclimate.com/v1/badges/cae4d8e55c58e5cbc4b6/maintainability)](https://codeclimate.com/github/qiwi/license/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/cae4d8e55c58e5cbc4b6/test_coverage)](https://codeclimate.com/github/qiwi/license/test_coverage)
[![npm (scoped)](https://img.shields.io/npm/v/@qiwi/license)](https://www.npmjs.com/package/@qiwi/license)

[MIT](https://en.wikipedia.org/wiki/MIT_License) compatible and corresponding to the [Civil Code](https://en.wikipedia.org/wiki/Civil_Code_of_Russia) of the Russian Federation. 

* [License in English](./src/main/tpl/license_en.tpl) (en)
* [Лицензия на русском](./src/main/tpl/license_ru.tpl) (ru)

## Install
```bash
yarn add @qiwi/license -D
npm add @qiwi/license -D
```

## Usage
Through CLI
```bash
qiwilicense --name='@qiwi/some-project' --cwd=. --lang=en --file=LICENSE --type=mit --year=2019
```
With [npx](https://blog.npmjs.org/post/162869356040/introducing-npx-an-npm-package-runner)
```bash
npx @qiwi/license --type=mit --year=2019 --cwd=/some/path
```


TS/JS
```ts
import {generate, render} from '@qiwi/license'

// Get the text and do something next
const text = render({
  lang: 'ru',
  year: '2010-2019'
})

// Or just write to a file:
generate({
  name: 'PROJECT_NAME',
  cwd: resolve(__dirname, '../foo/bar'),
  lang: 'en',
  year: '2019'
})
```

## Options
| Option                  | Description                                | Default                    |
|-------------------------|--------------------------------------------|----------------------------|
| `year`, `y`             | Sets year                                  | `new Date().getFullYear()` |
| `lang`, `l`             | Text language                              | `en`                       |
| `file`, `f`             | License file name                          | `LICENSE`                  |
| `cwd`, `c`, `dir`, `d`  | License target dir                         | `process.cwd()`            |
| `name`, `n`             | Project name                               | `name` from `package.json` |
| `type`, `t`             | License type                               | `qosl`                     |
| `patch-pkg-json`        | Set/update license field of `package.json` | `false`                    |

## License
MIT
npm package: @qiwi/logwrap
Description: Logwrap facade
Author: Anton Golub
Latest version: 1.5.1

# @qiwi/logwrap
Logwrap facade.

### Install
```bash
yarn add @qiwi/logwrap
npm i @qiwi/logwrap
```

### Usage

```javascript
// logger.js

import {Logwrap} from '@qiwi/logwrap'

const logwrap = new Logwrap({
  pipeline: [console],
  level: 'debug'
})

export default logwrap
```
npm package: @qiwi/logwrap-core
Description: Logwrap core assets
Author: Anton Golub
Latest version: 1.5.0

# @qiwi/logwrap-core
Logwrap core assets.

### Install
```bash
yarn add @qiwi/logwrap-core
npm i @qiwi/logwrap-core
```

### Usage

```javascript
// logger.js

import {Logwrap} from '@qiwi/logwrap-core'

const logwrap = new Logwrap({
  pipeline: [console],
  level: 'debug'
})

export default logwrap
```
npm package: @qiwi/logwrap-mdc
Description: Logwrap mdc meta injector
Author: Anton Golub
Latest version: 1.5.1

# @qiwi/logwrap-mdc
Logwrap MDC injector.

### Install
```bash
yarn add @qiwi/logwrap-mdc
npm i @qiwi/logwrap-mdc
```

### Usage

```javascript
// logger.js

import {Logwrap} from '@qiwi/logwrap-core'
import mdc from '@qiwi/logwrap-mdc'

const mdcPipe = mdc()
const logwrap = new Logwrap({
  pipeline: [mdcPipe, console],
  level: 'DEBUG'
})

export default logwrap
```
npm package: @qiwi/masker
Description: Composite data masking utility
Author: Anton Golub
Latest version: 2.0.1

# @qiwi/masker
Composite data masking utility.

## Key features
* Composite and configurable
* Sync and async API
* TS and Flow typings

## Install
```shell
yarn add @qiwi/masker
```

## Usage
### masker
Default masker is applicable for most std cases: for strings, objects, json strings, which may contain any standard secret [keys](https://github.com/qiwi/masker/tree/master/packages/secret-key), [values](https://github.com/qiwi/masker/tree/master/packages/secret-value) or [PANs](https://github.com/qiwi/masker/tree/master/packages/pan).
```ts
import {masker} from '@qiwi/masker'

masker('411111111111111')       // Promise<4111 **** **** 1111>
masker.sync('4111111111111111') // 4111 **** **** 1111

masker.sync({
  token: 'foo bar',
  password: 'bazqux',
  details: {
    pans: ['4111111111111111', '1234123412341234'],
    some: 'value'
  }
})

/*
{
  token: '***',
  password: '***',
  details: {
    pans: ['4111 **** **** 1111', '1234123412341234'],
    some: 'value'
  }
}
*/
```

### createMasker
The masker factory builds a new masker instance with custom options (pipeline, registry, etc):
```ts
import {createMasker, registry} from '@qiwi/masker'

const masker = createMasker({
  registry,
  pipeline: ['split', 'strike']
})

masker.sync({
  foo: {
    bar: {
      baz: 'baaaaz'
    },
    qux: null,
    quux: 'qu ux'
  }
})
/*
{
  foo: {
    bar: {
      baz: '******'
    },
    qux: null,
    quux: '** **'
  }
}
*/
```

### registry
`registry` provides plugin-by-name resolution for pipelines. This mechanics is strictly required by the [schema](https://github.com/qiwi/masker/tree/master/packages/schema) processor.
```ts
import {masker} from '@qiwi/masker'
import pan from '@qiwi/masker-pan'

masker('data', {pipeline: [pan]})
```
```ts
import {registry} from '@qiwi/masker'
import pan from '@qiwi/masker-pan'

registry.add(pan)

masker('data', {pipeline: ['pan'], registry})
```
npm package: @qiwi/masker-common
Description: Data masker common assets
Author: Anton Golub
Latest version: 2.0.1

# @qiwi/masker-common
Masker common components: interfaces, executor, utils

## Install
```shell
yarn add @qiwi/masker-common
```

## Usage

### Context
```ts
export interface IEnrichedContext {
  value: any                // value to process
  _value?: any              // pipe result
  id: IContextId            // ctx unique key
  context: IEnrichedContext // ctx self ref
  parentId?: IContextId     // parent ctx id
  registry: IMaskerRegistry       // pipe registry attached to ctx
  execute: IEnrichedExecutor      // executor 
  sync: boolean                   // sync / async switch
  mode: IExecutionMode            // lagacy sync switch
  opts: IMaskerOpts               // current pipe options
  pipe?: IMaskerPipeNormalized              // current pipe ref
  pipeline: IMaskerPipelineNormalized       // actual pipeline
  originPipeline: IMaskerPipelineNormalized // origin pipeline
  [key: string]: any
}
```

### createPipe()
Creates a pipe entity. Several pipes are combined into a `pipeline` to be processed by `executor`.
```ts
import {createPipe} from '@qiwi/masker-common'

const pipe = createPipe('foo', () => ({value: 'syncfoo'}), async () => ({value: 'asyncfoo'}))

pipe.name       // 'foo'
pipe.sync({})   // {value: 'syncfoo'}
await pipe({})  // {value: 'asyncfoo'}
```

### getPipe()
Get pipe from registry.
```ts
import {getPipe, crearePipe as cp} from '@qiwi/masker-common'

const pipe = cp('foo', () => ({value: 'foo'}))
const registry = new Map()

registry.set('foo', pipe)
getPipe('foo', registry) // pipe
```

### execute()
The pipeline executor. Transforms the target value (ctx) via the handlers queue. Provides both sync and async modes.
```ts
import {createPipe as cp, execute} from '@qiwi/masker-common'

const pipe1 = cp('pipe1', () => ({value: 'pipe1'}))
const pipe2 = cp('pipe2', ({value}) => ({value: value + 'pipe2'}))
const pipeline = [pipe1, pipe2]

const value = 'foobar'

// async
await execute({pipeline, value})        // {value: 'pipe1pipe2'}

// sync
execute({pipeline, value, sync: true})  // {value: 'pipe1pipe2'}
execute.sync({pipeline, value})         // {value: 'pipe1pipe2'}
```

## License
[MIT](https://github.com/qiwi/masker/blob/master/LICENSE)
npm package: @qiwi/masker-debug
Description: Masker debugger plugin
Author: Anton Golub
Latest version: 2.0.1

# @qiwi/masker-debug
The plugin to debug masker pipes effects.

## Install
```shell script
yarn add @qiwi/masker-debug
```

## Usage
```typescript
import {masker, createPipe} from '@qiwi/masker-common'
import {pipe as debug} from '@qiwi/masker-debug'

const success = createPipe('success', () => ({value: 'success'}))

// Enable debugger in any way:
// * Set DEBUG=masker
// * require('debug').enable('masker')

masker.sync('foobar', {
  pipeline: [debug, success]
})
```

```shell
masker before <ref *2> {
  value: 'foobar',
  registry: Map(0) {},
  sync: true,
  mode: 'sync',
  execute: <ref *1> [Function (anonymous)] {
    sync: [Function: t],
    execSync: [Function: t],
    exec: [Circular *1]
  },
  pipe: {
    name: 'success',
    execSync: [Function (anonymous)],
    exec: [Function (anonymous)],
    opts: {}
  },
  id: '57295723',
  parentId: undefined,
  pipeline: [
    {
      name: 'success',
      execSync: [Function (anonymous)],
      exec: [Function (anonymous)],
      opts: {}
    }
  ],
  originPipeline: [
    {
      name: 'success',
      execSync: [Function (anonymous)],
      exec: [Function (anonymous)],
      opts: {}
    }
  ],
  opts: {},
  context: [Circular *2]
} +0ms
```

## License
[MIT](https://github.com/qiwi/masker/blob/master/LICENSE)
npm package: @qiwi/masker-infra
Description: Data masker infra package
Author: Anton Golub
Latest version: 2.0.0

# @qiwi/masker-infra
[@qiwi/masker](https://github.com/qiwi/masker) monorepo infra assets: build utils and configs.

## License
[MIT](https://github.com/qiwi/masker/blob/master/LICENSE)
npm package: @qiwi/masker-json
Description: JSON data extractor
Author: Anton Golub
Latest version: 2.0.1

# @qiwi/masker-json
JSON extractor pipe

## Install
```shell script
yarn add @qiwi/masker-json
```

## Usage
```typescript
import {masker} from '@qiwi/masker-common'
import {json} from '@qiwi/masker-json'
import {split} from '@qiwi/masker-split'
import {strike} from '@qiwi/masker-strike'

masker('{"foo": "bar"}  foo bar', {
  pipeline: [json, split, strike]
})
// '{"***": "***"}  foo bar'
```

## License
[MIT](https://github.com/qiwi/masker/blob/master/LICENSE)
npm package: @qiwi/masker-limiter
Description: The plugin to limit masking steps and duration
Author: Anton Golub
Latest version: 2.0.1

# @qiwi/masker-limiter
The plugin to limit masking steps and duration

## Install
```shell script
yarn add @qiwi/masker-limiter
```

## Usage
To limit the execution steps:
```typescript
import {createMasker, pipeline, createPipe, registry} from '@qiwi/masker'
import {pipe as limiter} from '@qiwi/masker-limiter'

const echo = createPipe('echo', (v) => ({v}))
const masker = createMasker({
  registry,
  pipeline: [[limiter, {limit: 7, pipeline: ['plain']}], 'split', echo]
})
const obj = {
  foo: 'foo',
  bar: 'bar',
  baz: 'baz',
}

masker.sync(obj)

// [echo, split] was invoked for `obj` - 2
// [echo, split] for `obj.foo` value — 4
// [echo, split] for `obj.bar` value — 6
// [echo, split] for `obj.bar` value — 8 > 7
// so the last `split` was replaced with fallback pipes [plain],
// therefore `baz` value has become `***`
// and all the rest keys were converted with [plain] pipeline too:
{
  '***': 'foo',
  '***(2)': 'bar',
  '***(3)': '***',
}
```
To limit the exec duration:
```ts
import {createMasker, pipeline, registry, createPipe} from '@qiwi/masker'
import {pipe as limiter} from '@qiwi/masker-limiter'

let delay = 0
const sleep = (ms: number): Promise<void> => new Promise(resolve => setTimeout(resolve, ms))
const echoPipe = createPipe(
  'echo',
  ({value}: any) => ({value}),
  async({value}: any) => {
    // NOTE split executes queues in parallel, so we use progressive delay
    await sleep(delay += 25)
    return {value}
  },
)
const masker = createMasker({
  registry,
  pipeline: [[limiter, {duration: 100}], echoPipe, 'split'],
})
const obj = ['foo', 'bar', 'baz']

await masker(obj)

// result:
['foo', '***', '***']
```

## License
[MIT](https://github.com/qiwi/masker/blob/master/LICENSE)
npm package: @qiwi/masker-pan
Description: Plain data masker
Author: Anton Golub
Latest version: 2.0.1

# @qiwi/masker-pan
PAN masker pipe

## Install
```shell script
yarn add @qiwi/masker-pan
```

## Usage
```typescript
import {masker} from '@qiwi/masker'
import {pipe as pan} from "@qiwi/masker-pan"

masker('4111111111111111', {
  pipeline: [pan]
})
// 4111 **** **** 1111
```

## License
[MIT](https://github.com/qiwi/masker/blob/master/LICENSE)
npm package: @qiwi/masker-plain
Description: Plain data masker
Author: Anton Golub
Latest version: 2.0.1

# @qiwi/masker-plain
Plain masker pipe

## Install
```shell script
yarn add @qiwi/masker-plain
```

## Usage
```typescript
import {masker} from '@qiwi/masker'
import {pipe as plain} from '@qiwi/masker-plain'

masker('foobar', {
  pipeline: [plain]
})
// ***
```

## License
[MIT](https://github.com/qiwi/masker/blob/master/LICENSE)
npm package: @qiwi/masker-schema
Description: Data masker schema processor
Author: Anton Golub
Latest version: 2.0.1

# @qiwi/masker-schema
Masker scheme builder and executor

## Features
* Builds object `schema` on masking 
* Applies masker `schema` to object as a directive

Masker schema is a superset of a regular json-schema. 
It introduces `maskValue` and `maskKey` directives to declare pipelines for object parts.
```ts
export interface IMaskerSchema {
  type?: any
  maskValue?: Array<IMaskerDirective>
  maskKey?: Array<IMaskerDirective>
  properties?: Record<string, IMaskerSchema>
  items?: Record<string, IMaskerSchema> | Array<IMaskerSchema>
}
```

## Install
```shell script
yarn add @qiwi/masker-schema
```

## Usage
```typescript
import {pipeline, createMasker} from '@qiwi/masker'
import {pipe as schema} from '@qiwi/masker-schema'

const masker = createMasker({
  pipeline: [schema, ...pipeline]
})

const obj = {
  token: 'foo bar',
  password: 'bazqux',
  details: {
    pans: ['4111111111111111', '1234123412341234'],
    some: 'value'
  }
}
const res = masker.sync(obj, {unbox: false})

// res.value
{
  token: '***',
  password: '***',
  details: {
    pans: ['4111 **** **** 1111', '1234123412341234'],
    some: 'value',
  },
}

// res.schema
{
  type: 'object',
  properties: {
    token: {type: 'string', maskValue: ['plain', 'secret-key']},
    password: {type: 'string', maskValue: ['plain', 'secret-key']},
    details: {
      type: 'object',
      properties: {
        pans: {
          type: 'object',
          properties: {0: {type: 'string', maskValue: ['pan']}, 1: {type: 'string'}},
        }, some: {type: 'string'},
      },
    },
  },
}
```

Now `res.schema` may be applied to similar objects/instances.
```ts
const _res = masker.sync(obj, {unbox: false, schema: res.schema})
```

The entries, which have no `maskValue` or `maskKey`, will be not processed at all. 
Masker wouldn't even try to observe its inners. This feature makes a lot of sense if you deal with huge same-structured objects.
```ts
import {pipeline, createMasker, registry} from '@qiwi/masker'
import {pipe as schema} from '@qiwi/masker-schema'

const obj = {
  foo: 'foo foo',
  bar: 'bar',
  baz: 'baz',
}
const masker = createMasker({
  registry,
  pipeline: [schema, ...pipeline],
})
const masked = masker.sync(obj, {
  schema: {
    type: 'object',
    properties: {
      foo: {
        type: 'string',
        maskValue: ['strike'],
      },
    },
  },
})

// masked:
{
  foo: '*** ***',
  bar: 'bar',
  baz: 'baz',
}
```

## License
[MIT](https://github.com/qiwi/masker/blob/master/LICENSE)
npm package: @qiwi/masker-secret-key
Description: Hide sensitive data by key/path pattern match
Author: Anton Golub
Latest version: 2.0.1

# @qiwi/masker-secret-key
Hide sensitive data by key/path pattern match

## Install
```shell script
yarn add @qiwi/masker-secret-key
```

## Usage
```typescript
import {masker} from '@qiwi/masker'
import {pipe as secretKey} from '@qiwi/masker-secret-key'

masker({ secret: 'foo' }, {
  pipeline: [[secretKey, {pattern: /secret/g, pupeline: ['plain']}]]
})
// {secret: '***'}
```

## License
[MIT](https://github.com/qiwi/masker/blob/master/LICENSE)
npm package: @qiwi/masker-secret-value
Description: Masker plugin to hide sensitive values by pattern
Author: Anton Golub
Latest version: 2.0.1

# @qiwi/masker-secret-value
Masker plugin to conceal sensitive values by pattern match.

## Install
```shell script
yarn add @qiwi/masker-secret-value
```

## Usage
```typescript
import {masker} from '@qiwi/masker'
import {pipe} from '@qiwi/masker-secret-value'

masker('fooo bar baz foobar qux q', {
  pipeline: [['secret-value', {pattern: /\w{4,}/g}]]
})
// **** bar baz ****** qux q
```

## License
[MIT](https://github.com/qiwi/masker/blob/master/LICENSE)
npm package: @qiwi/masker-sensor
Description: Hide sensitive data by sensor name
Author: Anton Golub
Latest version: 1.2.0

# @qiwi/masker-sensor
Hide sensitive data by path match

## Install
```shell script
yarn add @qiwi/masker-sensor
```

## Usage
```typescript
import {masker} from '@qiwi/masker-common'
import {pipe} from "@qiwi/masker-sensor";

masker.register(pipe)

masker('fooo bar baz foobar qux q', {
  pipeline: [['sensor', {pattern: /\w{4,}/g}]]
})
// **** bar baz ****** qux q
```
npm package: @qiwi/masker-split
Description: data masker splitter
Author: Anton Golub
Latest version: 2.0.1

# @qiwi/masker-split
Masker plugin to recursively process any kind of js objects

## Install
```shell script
yarn add @qiwi/masker-split
```

## Usage
```typescript
import {masker} from '@qiwi/masker'
import {pipe} from '@qiwi/masker-split'

masker.sync({foo: 'bar', baz: 'qux'}, {
  pipeline: ['split', 'plain']
})

// result:
{
  '***': '***',
  '***(2)': '***'
}
```

## License
[MIT](https://github.com/qiwi/masker/blob/master/LICENSE)
npm package: @qiwi/masker-strike
Description: Strike data masker
Author: Anton Golub
Latest version: 2.0.1

# @qiwi/masker-strike
The plugin to ~~strikethough~~ any non-space string chars.

## Install
```shell script
yarn add @qiwi/masker-strike
```

## Usage
```typescript
import {masker} from '@qiwi/masker'
import {pipe} from '@qiwi/masker-strike'

masker.sync('foo bar baz', {
  pipeline: ['strike']
})
// *** *** ***
```

## License
[MIT](https://github.com/qiwi/masker/blob/master/LICENSE)
npm package: @qiwi/masker-trycatch
Description: The plugin to capture masker exceptions
Author: Anton Golub
Latest version: 2.0.1

# @qiwi/masker-trycatch
The plugin to capture masker exceptions.

## Install
```shell script
yarn add @qiwi/masker-trycatch
```

## Usage
```typescript
import {masker} from '@qiwi/masker'
import {createPipe} from '@qiwi/masker-common'
import {pipe} from '@qiwi/masker-trycatch'

const errorPipe = createPipe('err', () => {
  throw new Error('Error')
})

masker.sync('foobar', {
  pipeline: [['trycatch', {pipeline: ['plain']}], errorPipe]
})

// '***'
```

## License
[MIT](https://github.com/qiwi/masker/blob/master/LICENSE)
npm package: @qiwi/module-federation-manifest-plugin
Description: Module Federation manifest plugin
Latest version: 1.1.2

# module-federation-manifest-plugin

[![CI](https://github.com/qiwi/module-federation-manifest-plugin/actions/workflows/ci.yaml/badge.svg?branch=master)](https://github.com/qiwi/module-federation-manifest-plugin/actions/workflows/ci.yaml)
[![Maintainability](https://api.codeclimate.com/v1/badges/b393ef93cb69397b2738/maintainability)](https://codeclimate.com/github/qiwi/module-federation-manifest-plugin/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/b393ef93cb69397b2738/test_coverage)](https://codeclimate.com/github/qiwi/module-federation-manifest-plugin/test_coverage)
[![npm (tag)](https://img.shields.io/npm/v/@qiwi/module-federation-manifest-plugin/latest.svg)](https://www.npmjs.com/package/@qiwi/module-federation-manifest-plugin)

> Webpack plugin to generate manifest about module federation: shared, exposed, remote modules

### Install

```bash
yarn add -D @qiwi/module-federation-manifest-plugin
npm i -D @qiwi/module-federation-manifest-plugin
```

### Usage

Add plugin to webpack config. This plugin works together with `ModuleFederationPlugin`. In case of usage without it error will be raised

```typescript
import webpack from 'webpack'
import path from 'path'
import { ModuleFederationManifestPlugin } from '@qiwi/module-federation-manifest-plugin'

export const config: webpack.Configuration = {
  plugins: [
    new webpack.container.ModuleFederationPlugin({
      /** Your options here */
    }),
    new ModuleFederationManifestPlugin({
      filename: 'manifest.json',
    }),
  ],
}
```

## Manifest schema

You can find schema description [here](https://github.com/qiwi/module-federation-manifest-plugin/blob/main/src/main/ts/schema.ts) and real examples in [tests](https://github.com/qiwi/module-federation-manifest-plugin/blob/main/src/test/ts/e2e.spec.ts)

## API

### Hooks

#### onManifestCreated

Invokes after manifest created, but not emitted

```javascript
compiler.hooks.compilation.tap('MyPlugin', (compilation) => {
  ModuleFederationManifestPlugin.getHooks(compilation).onManifestCreated.tap('MyPlugin', (manifest) => {
    console.log(manifest)
  })
})
```

## License

[MIT](./LICENSE)
npm package: @qiwi/mware
Description: Commmon middlewares collection
Author: Anton Golub
Latest version: 1.14.3

# mware
Common middlewares collection.

### Install
```bash
yarn add @qiwi/mware
npm i @qiwi/mware
```

### Middlewares
* [mware-mdc](../mdc/README.md)
* [mware-logger](../logger/README.md)
* [mware-crumbs](../crumbs/README.md)
* [mware-cors](../cors/README.md)
* [mware-validator](../validator/README.md)

### Usage

```javascript
import {cors, mdc} from '@qiwi/mware'
import express from 'express'

const app = express()

app.use(cors())
app.use(mdc())
app.listen(...)
```

### Utils
```js
import express from 'express'
import {util} from '@qiwi/mware'

const {asyncMiddleware} = util
...

app.get('/', asyncMiddleware(async (req, res, next) => {
    ...
    throw new Error('Something went wrong')
}))

app.use((error, req, res, next) => {
    error // Error('Something went wrong')
})
```
### License
MIT
npm package: @qiwi/mware-context
Description: Cls-based contextify middleware
Author: Anton Golub
Latest version: 1.14.1

# @qiwi/mware-context
Middleware to attach CLS-based context to current request.

### Install
```bash
#yarn
yarn add @qiwi/mware-context
#npm
npm i @qiwi/mware-context
```

### Usage

```javascript
import clscxt, {DEFAULT_NS, getContext} from '@qiwi/mware-context'

import express from 'express'

const app = express()
app.use(clscxt({ns: DEFAULT_NS}))

app.get('/foo/bar', (req, res) => {
  getContext().get('some-value-like-trace')
})
```

### License
MIT
npm package: @qiwi/mware-core
Description: Common middlewares core
Author: Anton Golub
Latest version: 1.13.1

# @qiwi/mware-core
Common middlewares core assets.

### Install
```bash
yarn add @qiwi/mware-core
npm i @qiwi/mware-core
```

### Usage

```javascript
import {util} from '@qiwi/mware-core'
import express from 'express'

const app = express()
const am = util.asyncMiddleware

app.get('/profile/:profileId', am(async (req, res) => {
  const data = await someService.getProfile(req.headers.authorization, req.params.profileId)

  if (!data) {
    res.status(404).send('Not found')
  }

  res.send(data)
}))

app.listen(...)
```

### License
MIT
npm package: @qiwi/mware-cors
Description: CORS middleware
Author: Anton Golub
Latest version: 1.13.1

# @qiwi/mware-cors
CORS middleware

### Install
```bash
yarn add @qiwi/mware-cors
npm i @qiwi/mware-cors
```

### Usage

```javascript
import cors from '@qiwi/mware-cors'
import express from 'express'

const app = express()
app.use(cors())

app.get('/foo/bar', (req, res) => {
  res.send('foo')
})

/*
 RES {
  headers: { 
    'Access-Control-Allow-Origin': '*',
    'Access-Control-Allow-Methods': 'GET, HEAD, PATCH, PUT, POST, DELETE, OPTIONS'
    ...
  },
  ...
 }
 */

app.listen(...)
```

### License
MIT
npm package: @qiwi/mware-crumbs
Description: XF* proxying middleware
Author: Anton Golub
Latest version: 1.14.1

# @qiwi/mware-crumbs
X-Forwarded-* proxying middleware

### Install
```bash
yarn add @qiwi/mware-crumbs
npm i @qiwi/mware-crumbs
```

### Usage

```javascript
import crumbs from '@qiwi/mware-crumbs'
import express from 'express'
import request from 'request'

const app = express()
app.use(crumbs())

app.get('/foo/bar', (req, res) => {
  req.pipe(request({...})).pipe(res)
})

app.listen(...)
```
### License
MIT
npm package: @qiwi/mware-logger
Description: reqres logging middleware
Author: Anton Golub
Latest version: 1.15.1

# @qiwi/mware-logger
Request/response logger middleware

### Install
```bash
yarn add @qiwi/mware-logger
npm i @qiwi/mware-logger
```

### Usage

```javascript
import logger from '@qiwi/mware-logger'
import express from 'express'

const app = express()
app.use(logger())

app.get('/foo/bar', (req, res) => res.status(503).send('foobar'))
// REQ 1f2146c00726d6f3 > method=GET target=/foo/bar origin=example.com ip=10.10.10.10 headers={\"origin\":\"example.com\",\"host\":null}
// RES ccb0fa3f9c8f5afc method=GET target=/foo/bar < status=503 duration=1ms headers={} bufferLength=6

app.listen(...)
```

### License
MIT
npm package: @qiwi/mware-mdc
Description: MDC middleware
Author: Anton Golub
Latest version: 1.14.1

# @qiwi/mware-mdc
Middleware for MDC headers processing 

### Install
```bash
yarn add @qiwi/mware-mdc
npm i @qiwi/mware-mdc
```

### Usage

```javascript
import mdc from '@qiwi/mware-mdc'
import express from 'express'

const app = express()
app.use(mdc())

app.get('/', (req, res) => {
  req.trace // {trace_id: 'baf7f0cd41768a7e', span_id: '7b94b0a800870252'}
  res.headers // {'x-b3-traceid': 'baf7f0cd41768a7e', 'x-b3-traceid': '7b94b0a800870252', ...}
})
app.listen(...)
```

### License
MIT
npm package: @qiwi/mware-validator
Description: JSON-schema based validator middleware
Author: Anton Golub
Latest version: 1.15.0

# @qiwi/mware-validator
JSON-schema based validator middleware

### Install
```bash
yarn add @qiwi/mware-validator
npm i @qiwi/mware-validator
```

### Usage

```javascript
import validator from '@qiwi/mware-validator'
import express from 'express'

const app = express()
const schema = {
  type: 'object',
  properties: {
    params: {
      id: {
        type: 'string',
        pattern: '[abc]^\d{2}',
        required: true
      }
    },
    query: {
      data: {
        type: 'object',
        required: true
      }
    }
  }
}
app.get('/foo/:id', validator({schema}), (req, res) => {
  ...
  res.send({...})
})

app.listen(...)
```

### License
MIT
npm package: @qiwi/nestjs-enterprise
Description: QIWI Nestjs enterprise facade
Author: Anton Golub
Latest version: 3.1.0

# @qiwi/nestjs-enterprise
*Facade*

## Install
```shell script
yarn add @qiwi/nestjs-enterprise
```

### [Docs](https://qiwi.github.io/nestjs-enterprise/facade/)
npm package: @qiwi/nestjs-enterprise-common
Description: QIWI Nestjs enterprise common assets
Latest version: 4.1.0

# @qiwi/nestjs-enterprise-common
*Common assets*

## Install
```shell script
yarn add @qiwi/nestjs-enterprise-common
```

## Decorators
### @Port
```typescript
import { Controller, Get} from '@nestjs/common'
import { Port } from '@qiwi/nestjs-enterprise-common'

@Controller()
export class CardInfoController {

  @Port('8080')
  @Get('only8080')
  async test(@Port() port: number) {
    return port
  }
}
```

- When used as a method decorator or class decorator, works like [guard](https://docs.nestjs.com/guards), letting only the specified port.
- When used as a parameter decorator, extracts port value from request.socket data.  

### @RequestSize
```typescript
import { Controller, Post,} from '@nestjs/common'
import { RequestSize } from '@qiwi/nestjs-enterprise-common'

// Class decorator
@Controller()
@RequestSize(512)
export class TestClassController {
  @Post('req-limit-512-class')
  async test(@RequestSize() size: number) {
    return size
  }
}

// Method decorator
@Controller()
export class TestMethodController {
  @RequestSize(512)
  @Post('req-limit-512-method')
  async test(@RequestSize() size: number) {
    return size
  }
}

// Parameter decorator
@Controller()
export class TestParamController {
  @Post('return-req-size')
  async test(@RequestSize() size: number) {
    return size
  }
}
```

- When used as a method decorator or class decorator, work like [guard](https://docs.nestjs.com/guards), allows a request that is smaller than the specified size.
- When used as a parameter decorator, get size of request.   

### [Docs](https://qiwi.github.io/nestjs-enterprise/common/)
npm package: @qiwi/nestjs-enterprise-connection-provider
Description: Nestjs connection-provider module
Latest version: 4.1.0

# @qiwi/nestjs-enterprise-connection-provider
Nestjs module for getting endpoints from serviceProfile

## Installation
Requires following packages to be installed
- [@qiwi/nestjs-enterprise-consul](https://github.com/qiwi/nestjs-enterprise/tree/master/packages/consul)

```shell script
yarn add @qiwi/nestjs-enterprise-connection-provider
```

## Configuration
Imports
```typescript
import { Module } from '@nestjs/common'
import { ConnectionProviderModule } from '@qiwi/nestjs-enterprise-connection-provider'
import { LoggerModule } from '@qiwi/nestjs-enterprise-logger-nestjs'
import { ConsulModule } from '@qiwi/nestjs-enterprise-consul-nestjs'
import { ConfigModule } from '@qiwi/nestjs-enterprise-config-nestjs'

@Module({
  imports: [
    ConsulModule,
    ConnectionProviderModule,
    // and so on
  ],
  controllers: [],
  providers: [],
})
export class AppModule {}
```

## Usage
```typescript
@Injectable()
export class ThriftClientProvider implements IThriftClientProvider {
    constructor(
    @Inject('IConnectionProvider') private connectionProvider: IConnectionProvider,
    @Inject('IConfig') private config: IConfig
    ) {}

  private async createConnection(
    serviceProfile: IThriftServiceProfile | string,
  ): Promise<IConnectionParams> {
    const profile = serviceProfile ? this.config.get(serviceProfile) : serviceProfile
    const connectionParams = await this.connectionProvider.getConnectionParams(profile)
    //...etc
  }
}
```

## API
### Class ConnectionProviderModule
Exports `IConnectionProvider` with token `IConnectionProviderService`
### Class ConnectionProviderService
#### getConnectionParams( serviceProfile: IServiceDeclaration ): Promise<IConnectionParams>

### [Docs](https://qiwi.github.io/nestjs-enterprise/connection-provider/)
npm package: @qiwi/nestjs-enterprise-consul
Description: Nestjs module for working with Consul
Latest version: 4.1.0

# @qiwi/nestjs-enterprise-consul
Nestjs module for working with Consul

## Installation
Requires following packages to be installed 
- [@qiwi/nestjs-enterprise-config](https://github.com/qiwi/nestjs-enterprise/tree/master/packages/config) 
- [@qiwi/nestjs-enterprise-logger](https://github.com/qiwi/nestjs-enterprise/tree/master/packages/logger)

```shell script
yarn add @qiwi/nestjs-enterprise-consul
```

## Configuration
```typescript
import { Module } from '@nestjs/common'
import { ConfigModule } from '@qiwi/nestjs-enterprise-config'
import { LoggerModule } from '@qiwi/nestjs-enterprise-logger'
import { ConsulModule } from '@qiwi/nestjs-enterprise-consul'

@Module({
  imports: [
    ConfigModule,
    LoggerModule,
    ConsulModule,
    // and so on
  ],
  controllers: [],
  providers: [],
})
export class AppModule {}
```

### Config
```json
{
  "data": {
    "name": "APP_NAME",
    "server": {
      "port": 8080,
      "host": "$host:"
    },
    "consul": {
      "host": "CONSUL_AGENT_HOST",
      "port": "CONSUL_AGENT_PORT",
      "token": "consul token",
      "tags": ["tag"]
    }
  },
  "sources": {
    "host": {
      "pipeline": "ip"
    }
  }
}
```

## Usage
```typescript
// main.ts
import { NestFactory } from '@nestjs/core'
import { AppModule } from './app.module'

async function bootstrap() {

  const app = await NestFactory.create(AppModule)
  //...
  
const consul = app.get('IConsul')
const local = config.get('local')
//...

  if (!local) {
    consul.register()
  }
}
 //...

```
```typescript
// service.ts
@Injectable()
export class ConnectionProviderService implements IConnectionProvider {
  constructor(
    @Inject('IConsul')
    private consul: IConsul,
  ) {}

  async getConnectionParams(serviceName: string) {
    return this.consul.getConnectionParams(serviceName)
  }
}

```

## API
### ConsulModule class
Exports `ConsulService` with token `IConsul`
### ConsulService class
#### register(opts: any): IPromise
#### getConnectionParams(opts: any): Promise<IConnectionParams | undefined>
| field | type  | description |
| --- | --- | --- |
|IConnectionParams.host | string | host
|IConnectionParams.port | number | port

#### getKv(opts: any): Promise \<INormalizedConsulKvValue>
| field | type  | description |
| --- | --- | --- |
|INormalizedConsulKvValue.createIndex | number | createIndex
|INormalizedConsulKvValue.modifyIndex | number | modifyIndex
|INormalizedConsulKvValue.lockIndex | number | lockIndex
|INormalizedConsulKvValue.key | string | key
|INormalizedConsulKvValue.flags | number | flags
|INormalizedConsulKvValue.value | string | value

### [Docs](https://qiwi.github.io/nestjs-enterprise/consul/)
npm package: @qiwi/nestjs-enterprise-logger
Description: Logger module for nestjs enterprise
Latest version: 4.1.0

# @qiwi/nestjs-enterprise-logger
Nestjs module for logging based on [winston](https://github.com/winstonjs/winston)

## Installation
Following packages should be installed before
- [@qiwi/nestjs-enterprise-config](https://github.com/qiwi/nestjs-enterprise/tree/master/packages/config)
- [@qiwi/nestjs-enterprise-mdc](https://github.com/qiwi/nestjs-enterprise/tree/master/packages/mdc)
```shell script
yarn add @qiwi/nestjs-enterprise-logger
```
## Configuration
Import
```typescript
import { 
  LoggerModule,
  createMetaPipe,
  maskerLoggerPipeFactory,
 } from '@qiwi/nestjs-enterprise-logger'

@Module({
  imports: [
    ConfigModule,
    LoggerModule.register(createMetaPipe(), maskerLoggerPipeFactory()),
    // and so on
  ]
})

export class AppModule {}
```

## Usage
```typescript
  @Injectable()
  class MyService {
    constructor(@Inject('ILogger') private logger: ILogger) {}
    myError() {
      this.logger.error('foo')
    }
    myInfo() {
      this.logger.info('foo')
    }

  }
```

For `createMetaPipe`
```typescript
import {
  logger as log,
} from '@qiwi/nestjs-enterprise-logger'

async function bootstrap() {
  const app = await NestFactory.create(AppModule)
  const logger = app.get('ILogger')
  app
    .use(log({ logger }))
    .useLogger(logger)

 //...
 logger.info()
```
## Customization
You can inject functions of type `TLoggerPipe` as your own pipes when create `LoggerService` or register `LoggerModule`.
Your pipes will be inserted in the following order:
- `mdc` pipe from `@qiwi/logwrap`;
- `app` pipe (adds app name, app version and os info to log entry);
- your own pipe;
- ...
- your own pipe;
- `logger` pipe (prints log entry).
## API
### Class LoggerModule 
Exports `LoggerService` with token `ILogger`
#### register (...pipes: TLoggerPipe[]): DynamicModule

### Class LoggerService
#### constructor(pipeline: TLoggerPipe[], config: IConfig)
#### push(entry: ILogEntry): void
| field | type  | description |
| --- | --- | --- |
|LogEntry.meta | Record<string, any>| Metadata
|LogEntry.level | ERROR &#124; WARN &#124; INFO &#124; DEBUG &#124; TRACE | Log level
|LogEntry.input | any[] | Data
#### trace(...data: any[]): void
#### debug(...data: any[]): void
#### info(...data: any[]): void
#### warn(...data: any[]): void
#### error(...data: any[]): void

### Function createMetaPipe = () => (entry: ILogEntry): ILogEntry
Creates pipe for metadata injection, used with [@qiwi-private/js-platform-mdc-nestjs](https://github.qiwi.com/common/js-platform/tree/master/packages/mdc-nestjs)

### Function maskerLoggerPipeFactory = () => (entry: ILogEntry): ILogEntry
Creates pipe for pan masking

### Function masker = (input: string | number): string
Masks pans

### [Docs](https://qiwi.github.io/nestjs-enterprise/logger/)
npm package: @qiwi/nestjs-enterprise-mdc
Description: MDC module for nestjs enterprise
Latest version: 4.1.0

# @qiwi/nestjs-enterprise-mdc
Nestjs module for working with continuation-local storage.

## Installation
```shell script
yarn add @qiwi/nestjs-enterprise-mdc
```

## Configuration
```typescript
import { MdcModule } from '@qiwi/nestjs-enterprise-mdc'

@Module({
  imports: [
    MdcModule,
    // and so on
  ],
  controllers: [],
  providers: [],
})
export class AppModule {}
```

## Usage
```typescript
// main.ts
import { mdc, logger as log, clscxt } from '@qiwi/nestjs-enterprise-mdc'

async function bootstrap() {
  const app = await NestFactory.create(AppModule)
 //...
  app
    .use(clscxt())
    .use(mdc())
    .use(log({ logger }))
 //...
```

## Api
#### mdc, validator, logger, context as clscxt
see [@qiwi/mware](https://github.com/qiwi/mware)

### [Docs](https://qiwi.github.io/nestjs-enterprise/mdc/)