open-index/open-npm huggingface dataset:
npm package: @mimik/cache-helper
Description: Cache helper for mimik microservices
Author: mimik technology inc
Latest version: 3.1.1

<a name="module_cache-helper"></a>

## cache-helper
**Example**  
```js
import cacheHelper from '@mimik/cache-helper';
```

* [cache-helper](#module_cache-helper)
    * [~cacheHelper(config)](#module_cache-helper..cacheHelper) ⇒ <code>object</code>
    * _async_
        * [~rpCached(type, options)](#module_cache-helper..rpCached) ⇒ <code>Promise</code>

<a name="module_cache-helper..cacheHelper"></a>

### cache-helper~cacheHelper(config) ⇒ <code>object</code>
Create a cache helper instance.

**Kind**: inner method of [<code>cache-helper</code>](#module_cache-helper)  
**Returns**: <code>object</code> - An object containing `rpCached`.  

| Param | Type | Description |
| --- | --- | --- |
| config | <code>object</code> | Configuration object. |
| config.cache | <code>object</code> | Cache settings. |
| config.cache.set | <code>string</code> | Set to `'on'` to enable caching; any other value disables it. |
| config.redisSettings | <code>object</code> | Redis settings. |
| config.redisSettings.request | <code>object</code> | Request-level Redis settings. |
| config.redisSettings.request.TTL | <code>number</code> | TTL in seconds for cached GET responses. |

<a name="module_cache-helper..rpCached"></a>

### cache-helper~rpCached(type, options) ⇒ <code>Promise</code>
Make a cached request.

**Kind**: inner method of [<code>cache-helper</code>](#module_cache-helper)  
**Category**: async  
**Throws**:

- <code>Error</code> Will throw the same error as `rpAuth` of `@mimik/oauth-helper`.

**Requires**: <code>module:@mimik/oauth-helper</code>, <code>module:@mimik/rediser</code>, <code>module:@mimik/sumologic-winston-logger</code>  
**Fulfil**: <code>object</code> - Response of the `rpAuth` of `@mimik/oauth-helper` request.  

| Param | Type | Description |
| --- | --- | --- |
| type | <code>string</code> | Type of micro-service to request. |
| options | <code>object</code> | Options for the request. Similar to `rpAuth` of `@mimik/oauth-helper` options. |
| options.method | <code>string</code> | HTTP method (e.g. `'GET'`, `'DELETE'`). |
| [options.uri] | <code>string</code> | Request URI. Used as the cache key for GET requests. |
| [options.url] | <code>string</code> | Request URL. Used as the cache key if `options.uri` is not set. |
| [options.headers] | <code>object</code> | Request headers, including optional `x-correlation-id` for request tracing. |
npm package: @mimik/edge-ms-helper
Description: a collection of libraries and functions to help developing mimik edge microservices
Author: mimik technology inc
Latest version: 1.3.2

# edge-ms-helper [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE) [![npm version](https://badge.fury.io/js/%40mimik%2Fedge-ms-helper.svg)](https://www.npmjs.com/package/@mimik/edge-ms-helper)

## Overview
This library is written using ES5 and ES6 JavaScript, and thus it is recommended to use babel-loader

[Learn how to use in your own project](https://developer.mimik.com).

Usually node_modules are excluded from using babel transpiler.  However, it is recommended to use babel-transpiler, and the configuration in Webpack can be seen below.

```JavaScript
exclude: /node_modules\/(?!edge-ms-helper)/,
```

## Supports
- https://developer.mimik.com

## License
[MIT licensed](./LICENSE).
npm package: @mimik/eslint-plugin-dependencies
Description: require/import dependency validation, bug fixed
Author: Andres Suarez
Latest version: 2.4.6

# eslint-plugin-dependencies

[![Build Status](https://travis-ci.org/zertosh/eslint-plugin-dependencies.svg?branch=master)](https://travis-ci.org/zertosh/eslint-plugin-dependencies)

## Usage

```sh
npm install eslint-plugin-dependencies
```

In your `.eslintrc`:

```json
{
  "plugins": [
    "dependencies"
  ],
  "rules": {
    "dependencies/case-sensitive": 1,
    "dependencies/no-cycles": 1,
    "dependencies/no-unresolved": 1,
    "dependencies/require-json-ext": 1
  }
}
```

## Rules

An [eslint](https://github.com/eslint/eslint) plugin that ...

### `dependencies/case-sensitive`

Verifies that `require("…")`, `require.resolve(…)`, `import "…"` and `export … from "…"` ids match the case that is reported by a directory listing.

```json
{
  "plugins": [
    "dependencies"
  ],
  "rules": {
    "dependencies/case-sensitive": [1, {"paths": ["custom-path-to-search-for-modules"]}]
  }
}
```

### `dependencies/no-cycles`

Prevents cyclic references between modules. It resolves `require("…")`, `import "…"` and `export … from "…"` references to internal modules (i.e. not `node_modules`), to determine whether there is a cycle. If you're using a custom parser, the rule will use that to parse the dependencies. The rule takes a `skip` array of strings, that will be treated as regexps to skip checking files.

Additionally, with the `types` option enabled, you can detect and prevent `import type` cycles as well. This can be helpful, since the [Flow checker](https://flow.org) can exhibit unexpected behavior with such cycles.

```json
{
  "plugins": [
    "dependencies"
  ],
  "rules": {
    "dependencies/no-cyles": [1, {"skip": ["/spec/", "/vendor/"], "types": true}]
  }
}
```

### `dependencies/no-unresolved`

Checks that `require("…")`, `require.resolve(…)`, `import "…"` and `export … from "…"` reference modules that exist. Takes an `ignore` array of modules to ignore.

```json
{
  "plugins": [
    "dependencies"
  ],
  "rules": {
    "dependencies/no-unresolved": [1, {"ignore": ["atom"], "paths": ["custom-path-to-search-for-modules"]}]
  }
}
```

### `dependencies/require-json-ext`

Ensures that modules are that are `.json` include their extension in the module id. Supports auto fix.
npm package: @mimik/git-hooks
Description: Git hooks helper for better development
Author: mimik technology inc
Latest version: 2.1.1

<a name="module_git-hooks"></a>

## git-hooks
**Example**  
```js
import { commitCheckMsg, validateCommit } from '@mimik/git-hooks';
// or
import gitHooks from '@mimik/git-hooks';
```

* [git-hooks](#module_git-hooks)
    * [~validateCommit(branchName, commitMsg)](#module_git-hooks..validateCommit) ⇒ <code>Object</code>
    * _async_
        * [~commitCheckMsg([options])](#module_git-hooks..commitCheckMsg) ⇒ <code>Promise.&lt;null&gt;</code>

<a name="module_git-hooks..validateCommit"></a>

### git-hooks~validateCommit(branchName, commitMsg) ⇒ <code>Object</code>
Validates a commit message against a branch name's JIRA ticket number.

The branch name must contain a JIRA ticket in the format `PROJ-123-` (with a trailing dash),
matching the convention for JIRA-generated branches (e.g. `feature/BES-1219-my-branch`).
The commit message must start with the same ticket number followed by a space and a
description of at least 10 characters.

**Kind**: inner method of [<code>git-hooks</code>](#module_git-hooks)  
**Returns**: <code>Object</code> - Result with `valid` flag and `error` message (null when valid).  

| Param | Type | Description |
| --- | --- | --- |
| branchName | <code>string</code> | The current git branch name (must contain `PROJ-123-` pattern with trailing dash). |
| commitMsg | <code>string</code> | The commit message to validate (must start with matching ticket number). |

**Example**  
```js
import { validateCommit } from '@mimik/git-hooks';
const result = validateCommit('feature/BES-1219-my-branch', 'BES-1219 implement user authentication');
// result: { valid: true, error: null }
```
<a name="module_git-hooks..commitCheckMsg"></a>

### git-hooks~commitCheckMsg([options]) ⇒ <code>Promise.&lt;null&gt;</code>
Checks the validity of the commit message against the current branch's JIRA ticket number.
Reads the commit message from the file at `process.argv[2]`.

**Kind**: inner method of [<code>git-hooks</code>](#module_git-hooks)  
**Returns**: <code>Promise.&lt;null&gt;</code> - Resolves with null on success. On failure, the process exits with code 1 (the promise never resolves).  
**Category**: async  

| Param | Type | Description |
| --- | --- | --- |
| [options] | <code>object</code> | Internal options for dependency injection (testing). |
| [options.git] | <code>function</code> | Git client factory (defaults to simpleGit). |

**Example**  
```js
import { commitCheckMsg } from '@mimik/git-hooks';
// or
import gitHooks from '@mimik/git-hooks';
```
npm package: @mimik/healthcheck
Description: system display at start for mimik microservices
Author: mimik technology inc
Latest version: 2.1.1

<a name="module_healthcheck"></a>

## healthcheck
**Example**  
```js
import { startupHealthInfo } from '@mimik/healthcheck';
// or
import healthcheck from '@mimik/healthcheck';
```
<a name="module_healthcheck..startupHealthInfo"></a>

### healthcheck~startupHealthInfo(config, correlationId) ⇒ <code>void</code>
Generate service startup message.

**Kind**: inner method of [<code>healthcheck</code>](#module_healthcheck)  
**Requires**: <code>module:@mimik/sumologic-winston-logger</code>, <code>module:@mimik/address-helper</code>  

| Param | Type | Description |
| --- | --- | --- |
| config | <code>object</code> | Configuration of the micro-service. |
| config.serverSettings | <code>object</code> | Server settings object. |
| config.serverSettings.name | <code>string</code> | Name of the micro-service. |
| config.serverSettings.id | <code>string</code> | Id of the micro-service. |
| config.serverSettings.port | <code>number</code> | Port the micro-service is listening on. |
| config.serverSettings.basePath | <code>string</code> | Base path of the micro-service. |
| config.serverSettings.public | <code>object</code> | Public address settings. |
| config.serverSettings.public.domainName | <code>string</code> | Domain name of the micro-service. |
| config.serverSettings.public.protocol | <code>string</code> | Protocol of the micro-service. |
| correlationId | <code>string</code> | CorrelationId to display during startup. |
npm package: @mimik/init
Description: Init process for micro-service
Author: mimik technology inc
Latest version: 6.1.4

<a name="module_init"></a>

## init
**Example**  
```js
import init from '@mimik/init';

init(app, rootDir, config, [dbValidate], cluster, { postOps: [subscribe] }).then(({ config: conf }) => config = conf);
```
<a name="module_init..init"></a>

### init~init(app, rootDir, config, validates, cluster, options) ⇒ <code>Promise.&lt;object&gt;</code>
Init process for a micro-service.

**Kind**: inner method of [<code>init</code>](#module_init)  
**Returns**: <code>Promise.&lt;object&gt;</code> - The updated configuration.

The options parameter has the following structure:
``` javascript
 {
   preOps: [function], // functions to process before starting the micro-service
   postOps: [function], // functions to process after starting the micro-service
   exitOps: [function], // functions to process before exiting the micro-service
   secOptions: { securityDefinition: function }, // extra security options to validate the API request
   extractName: string, // ability to extract data from the req and send it to a logging environment
   metrics: object, // to generate information for `/metrics`
   oidcOps: function, // OIDC operations to be called during init
   formats: object, // custom formats for API validation
 }
```
The `return` object has the following structure:
``` javascript
 {
   config: The configuration object,
 }
```
For the preOps, postOps and exitOps the functions are executed with 3 parameters (correlationId, config, server).
When `config.registration.afterPostOpsSet` is `'on'`, postOps runs before cluster registration; otherwise registration happens first.
The following routes are reserved: `/healthcheck` and `/metrics`.
The base path is defined by taking the URL property of the first item of the servers array in the API definition file. Only relative URL addresses will be handled (e.g. /mss/v1) and templates in the URL are not allowed.  

| Param | Type | Description |
| --- | --- | --- |
| app | <code>object</code> | The app implementing the micro-service. |
| rootDir | <code>string</code> | The root directory of the micro-service. |
| config | <code>object</code> | Configuration of the micro-service. |
| validates | <code>array</code> | Array of Promises to validate dependent systems (database, topic). |
| cluster | <code>object</code> | Object with `register` and `unRegister` methods for cluster management. |
| options | <code>object</code> | Options to start the micro-service. Can be `null`. |
npm package: @mimik/lib-filters
Description: Libraries for filter process
Author: mimik technology inc
Latest version: 2.0.9

<a name="module_lib-filters"></a>

## lib-filters
**Example** *(Default import)*  
```js
import libFilters from '@mimik/lib-filters';
```
**Example** *(Named imports)*  
```js
import { lengthyString, isProd, logs, MASK } from '@mimik/lib-filters';
```

* [lib-filters](#module_lib-filters)
    * [~MASK](#module_lib-filters..MASK) : <code>String</code>
    * _sync_
        * [~lengthyString(object, [length])](#module_lib-filters..lengthyString) ⇒ <code>Object</code>
        * [~isProd(env)](#module_lib-filters..isProd) ⇒ <code>Boolean</code>
        * [~logs(origObject, config)](#module_lib-filters..logs) ⇒ <code>Object</code>

<a name="module_lib-filters..MASK"></a>

### lib-filters~MASK : <code>String</code>
The default masking string used by [logs](logs) to replace sensitive values.

**Kind**: inner constant of [<code>lib-filters</code>](#module_lib-filters)  
**Default**: <code>&#x27;-------&#x27;</code>  
<a name="module_lib-filters..lengthyString"></a>

### lib-filters~lengthyString(object, [length]) ⇒ <code>Object</code>
Replace lengthy strings by --`(string length)`-- in a given object.

**Kind**: inner method of [<code>lib-filters</code>](#module_lib-filters)  
**Returns**: <code>Object</code> - The transformed object.  
**Category**: sync  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| object | <code>Object</code> |  | The object where strings will be replaced. |
| [length] | <code>Number</code> | <code>1000</code> | The length at which the replacement happens. If no length or a length of 0 is given the default length is 1000 characters. Optional. |

<a name="module_lib-filters..isProd"></a>

### lib-filters~isProd(env) ⇒ <code>Boolean</code>
Check if the environment is Production

**Kind**: inner method of [<code>lib-filters</code>](#module_lib-filters)  
**Returns**: <code>Boolean</code> - Returns true if env is undefined/null, or is 'prod'/'production' (case-insensitive)  
**Category**: sync  

| Param | Type | Description |
| --- | --- | --- |
| env | <code>String</code> | The environment property. |

<a name="module_lib-filters..logs"></a>

### lib-filters~logs(origObject, config) ⇒ <code>Object</code>
Mask the variables defined in the config on the object.
Follows the jsonpath pattern for masking: https://www.npmjs.com/package/jsonpath

**Kind**: inner method of [<code>lib-filters</code>](#module_lib-filters)  
**Returns**: <code>Object</code> - The filtered object.  
**Category**: sync  

| Param | Type | Description |
| --- | --- | --- |
| origObject | <code>Object</code> | The object to apply filtering. |
| config | <code>Array.&lt;String&gt;</code> | An array of JSONPath strings defining the fields to mask. |

**Example**  
```js
const filtered = logs(
  { password: 'secret', user: 'john' },
  ['$.password'],
);
// filtered.password === '-------'
// filtered.user === 'john'
```