open-index/open-npm huggingface dataset:
npm package: @lifeni/sudoku-solver
Description: A command line interface Sudoku solver, based on Node.js
Author: Lifeni
Latest version: 0.2.2
Deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

# Sudoku Solver

![npm](https://img.shields.io/npm/v/@lifeni/sudoku-solver)
![license](https://img.shields.io/npm/l/@lifeni/sudoku-solver)

A command line interface Sudoku solver, based on Node.js.

## Install

You can use npm or yarn to install it.

```shell
$ npm i -g @lifeni/sudoku-solver
# or
$ yarn global add @lifeni/sudoku-solver
```

## Usage

You should write Sudoku into a csv file like this:

```csv
# example.csv
1,, , ,4,8, , ,5
5,2, ,6, , , ,1,9
 ,7, , , ,1, , ,8
8,4, ,5, , ,9,3,
7,9, , , ,3, , ,
6, ,3, ,7, ,5,2,4
 , ,9, ,8,4, ,5,
3, ,1,7, ,2,8,4,6
 , ,7,3,6,5,1,9,
```

Run the command to get the result:

```shell
$ sudoku-solver example.csv

┌───────┬───────┬───────┐
│ 1 3 6 │ 9 4 8 │ 2 7 5 │
│ 5 2 8 │ 6 3 7 │ 4 1 9 │
│ 9 7 4 │ 2 5 1 │ 3 6 8 │
├───────┼───────┼───────┤
│ 8 4 2 │ 5 1 6 │ 9 3 7 │
│ 7 9 5 │ 4 2 3 │ 6 8 1 │
│ 6 1 3 │ 8 7 9 │ 5 2 4 │
├───────┼───────┼───────┤
│ 2 6 9 │ 1 8 4 │ 7 5 3 │
│ 3 5 1 │ 7 9 2 │ 8 4 6 │
│ 4 8 7 │ 3 6 5 │ 1 9 2 │
└───────┴───────┴───────┘

 ⏰ Time: 13.003ms
```

```shell
$ sudoku-solver -h

Usage: index [file]

A command line interface Sudoku solver, based on Node.js.

Options:
  -v, --version  show the version
  -h, --help     display help for command

Commands:
  log|logs       show logs
  read <file>    read a Sudoku from file
```

## Test

```shell script
$ npm test
```

## License

MIT License
npm package: @lifeomic/abac
Description: LifeOmic Attribute Based Access Control Support Module
Author: LifeOmic
Latest version: 5.0.0

# abac

This is a Javascript implementation of Attribute Based Access Control
use in Lifeomic products.

This module is suitable for use in both UIs and backend node.js services.

## Installation

```bash
yarn install @lifeomic/abac
```

## Terminology

- Rules
  - Comparison
    - `endsWith`: value being checked that ends with an exact string value
    - `equals`: value being checked is exactly equal to the value defined in the ABAC policy
    - `in`: value being checked is contained within the array in ABAC policy
    - `includes`: array of values includes the value in the ABAC policy
    - `notEquals`: value being checked does not equal the value defined in the ABAC policy
    - `notIn`: value not in ABAC array
    - `notIncludes`: array of values does not include the value in the ABAC policy
    - `prefixOf`: value being checked is a prefix of the value defined in the ABAC policy
    - `startsWith`: value being checked starts with an exact string value
    - `subset`: array of values is a subset of the array in the ABAC policy
    - `suffixOf`: value being checked is a suffix of the value defined in the ABAC policy
    - `superset`: array of values is a superset of the array in the ABAC policy
  - Target
    - Value of another attribute
  - Value
    - Literal value

## Usage

**TypeScript usage:**

```typescript
import * as abac from '@lifeomic/abac';

abac.validate(policy);
abac.merge(policies);
abac.reduce(policy, attributes);
abac.extract(policy, privileges, attribute);
abac.enforce(operationName, policy, attributes);
abac.enforceLenient(operationName, policy, attributes);
abac.enforceAny(operationName, policy, attributes);
abac.privileges(policy, attributes);
abac.privilegesLenient(policy, attributes);
abac.policyRequiresAttribute(policy, attribute);
```

See unit tests in `/test` folder - many good examples.

## Release process

Increment the version in `package.json`, make a PR, merge the PR,
and then finally create a new release using the github UI. Creating
the release will publish the head of master to npm. Name the
release `vX.Y.Z` to match the version in `package.json`.
npm package: @lifeomic/aws-sdk-helpers
Description: Utility methods to format data for AWS services
Author: LifeOmic
Latest version: 3.3.0

# aws-sdk-helpers

# DynamoDB

## Converter
Methods are provided to handle un/marshal calls to DynamoDB.Converter.marshal/unmarshal.  
These convenience methods are meant to handle instances where the item isn't provided, 
thus avoiding extra tests to get code coverage.

```typescript
import { dynamodb } from 'aws-sdk-helpers';
const { marshalItem, unmarshalItem } = dynamodb;
```

## Lambda Stream Event
These methods provide easy mocking of DyanmoDB Stream records.


### createStreamRecord
Provides some defaults, and properly structures the Records[].dynamodb object.

### createCustomStreamRecord
Provides some defaults and properly structures the Records[] entry.

### createCustomStreamRecord
A convenience method that converts Keys, OldImage, and NewImage and returns a DynamoDB Stream Record.

```typescript
import { dynamodb } from 'aws-sdk-helpers';
const { stream: { createCustomStreamRecord, createDynamoDBRecord } } = dynamodb;

const dynamodbRecords = originalData.map(([Keys, OldImage, NewImage]) => createCustomStreamRecord({
  Keys,
  OldImage,
  NewImage,
}));

const Records = dynamodbRecords.map(dynamodb => createDynamoDBRecord({dynamodb}));
const event = { Records };
await lambda.invoke(event, context);
```

## Releasing

This project uses semantic release. To trigger a release, merge a PR to master that includes commits prefixed with the relevant strings. For more info, see [the spec](https://www.conventionalcommits.org/en/v1.0.0/#specification).
npm package: @lifeomic/axios-fetch
Description: A WebAPI Fetch implementation backed by an Axios client
Author: LifeOmic
Latest version: 3.1.0

# Axios-Fetch

[![npm](https://img.shields.io/npm/v/@lifeomic/axios-fetch.svg)](https://www.npmjs.com/package/@lifeomic/axios-fetch)
[![Build Status](https://github.com/lifeomic/axios-fetch/actions/workflows/release.yaml/badge.svg)](https://github.com/lifeomic/axios-fetch/actions/workflows/release.yaml)
[![Coverage Status](https://coveralls.io/repos/github/lifeomic/axios-fetch/badge.svg?branch=master)](https://coveralls.io/github/lifeomic/axios-fetch?branch=master)
![Dependabot Badge](https://flat.badgen.net/dependabot/lifeomic/axios-fetch?icon=dependabot)

This library exposes a Fetch WebAPI implementation backed by an Axios client
instance. This allows a bridge between projects that have pre-configured Axios
clients already to other libraries that require Fetch implementations.

## Global Response object

It is expected that the global Response object will be available. For testing we use the [node-fetch
](https://www.npmjs.com/package/node-fetch) library.

```typescript
import { Response } from 'node-fetch';
// @ts-expect-error node-fetch doesn't exactly match the Response object, but close enough.
global.Response = Response;
```

## Example

One library that wants a Fetch implementation is the [Apollo Link
HTTP](https://www.apollographql.com/docs/link/links/http.html) library. If your
project has an existing Axios client configured, then this project can help you
use that client in your apollo-link-http instance. Here is some sample code:

```javascript
const { buildAxiosFetch } = require("@lifeomic/axios-fetch");
const { createHttpLink } = require("apollo-link-http");
const link = createHttpLink({
  uri: "/graphql",
  fetch: buildAxiosFetch(yourAxiosInstance)
});
```

## Transforming requests

It is possible to transform requests before they reach your Axios client by providing
an optional argument to `buildAxiosFetch`. For example, if you wanted a fetch implementation
that always set the request timeout to 1 second, you could use code like:

```javascript
const { buildAxiosFetch } = require("@lifeomic/axios-fetch");
const fetch = buildAxiosFetch(yourAxiosInstance, function (config) {
  config.timeout = 1000;
  return config;
});
```

## Support for IE11

To Support IE11 add following dependencies

```
 npm install --save isomorphic-fetch
 npm install --save es6-promise
```

After adding these dependencies import in index.jsx file at top (Need to import before React)

```javascript
import * as es6Promise from 'es6-promise';
import 'isomorphic-fetch';

es6Promise.polyfill(); // below all import end
```
npm package: @lifeomic/chromicons
Description: <p align="center">   <a href="https://github.com/lifeomic/chromicons">     <img src="https://github.com/lifeomic/chromicons/blob/master/.github/chromicons@2x.png?raw=true" alt="Chromicons" width="300" />   </a> </p>
Author: LifeOmic
Latest version: 3.12.0

# Chromicons

<p align="center">
  <a href="https://github.com/lifeomic/chromicons">
    <img src="https://github.com/lifeomic/chromicons/blob/master/.github/chromicons@2x.png?raw=true" alt="Chromicons" width="300" />
  </a>
</p>

<br>

Handcrafted open source icons from LifeOmic. Ready to use in web, iOS, Android, and desktop apps. Completely open source, MIT licensed, and built with ♥️ by the team at LifeOmic.

## Usage

### npm package 📦

The recommended path for usage is via the package on npm.

1. Install Dependency

```bash
yarn add @lifeomic/chromicons
```

2. Import Icons!

```js
import { Apple } from '@lifeomic/chromicons';
```

**With React-Native**

1. Install Dependency

```bash
yarn add @lifeomic/chromicons-png
```

2. Import Icons!

Icon images are stored in the `lined` folder. Each icon has its own folder with images for different screen densities (@1x, @1.5x, @2x, ..., @4x). Usage:

```jsx
<Image
  style={{ height: 24, width: 24, tintColor: 'red' }}
  source={require('@lifeomic/chromicons-png/lined/apple/apple.png')}
/>
```

**With React-Native (react-native-svg)**

1. Install Dependencies

```bash
yarn add @lifeomic/chromicons-native
```

2. Import the Icon Components

```jsx
import { Apple } from '@lifeomic/chromicons-native';

<Apple stroke="red" />;
```

### Web App 💻

You can view and copy all of the SVGs to your clipboard via the [web app](https://lifeomic.github.io/chromicons.com/). It also provides a link to download all raw SVGs.

## Icon Requests

Have an icon you want designed? File a GitHub issue and we'd be happy to create it for you!
npm package: @lifeomic/chromicons-native
Description: <p align="center">   <a href="https://github.com/lifeomic/chromicons">     <img src="https://github.com/lifeomic/chromicons/blob/master/.github/chromicons@2x.png?raw=true" alt="Chromicons" width="300" />   </a> </p>
Author: LifeOmic
Latest version: 3.12.0

# Chromicons

<p align="center">
  <a href="https://github.com/lifeomic/chromicons">
    <img src="https://github.com/lifeomic/chromicons/blob/master/.github/chromicons@2x.png?raw=true" alt="Chromicons" width="300" />
  </a>
</p>

<br>

Handcrafted open source icons from LifeOmic. Ready to use in web, iOS, Android, and desktop apps. Completely open source, MIT licensed, and built with ♥️ by the team at LifeOmic.

## Usage

### npm package 📦

The recommended path for usage is via the package on npm.

1. Install Dependency

```bash
yarn add @lifeomic/chromicons
```

2. Import Icons!

```js
import { Apple } from '@lifeomic/chromicons';
```

**With React-Native**

1. Install Dependency

```bash
yarn add @lifeomic/chromicons-png
```

2. Import Icons!

Icon images are stored in the `lined` folder. Each icon has its own folder with images for different screen densities (@1x, @1.5x, @2x, ..., @4x). Usage:

```jsx
<Image
  style={{ height: 24, width: 24, tintColor: 'red' }}
  source={require('@lifeomic/chromicons-png/lined/apple/apple.png')}
/>
```

**With React-Native (react-native-svg)**

1. Install Dependencies

```bash
yarn add @lifeomic/chromicons-native
```

2. Import the Icon Components

```jsx
import { Apple } from '@lifeomic/chromicons-native';

<Apple stroke="red" />;
```

### Web App 💻

You can view and copy all of the SVGs to your clipboard via the [web app](https://lifeomic.github.io/chromicons.com/). It also provides a link to download all raw SVGs.

## Icon Requests

Have an icon you want designed? File a GitHub issue and we'd be happy to create it for you!
npm package: @lifeomic/chromicons-png
Description: <p align="center">   <a href="https://github.com/lifeomic/chromicons">     <img src="https://github.com/lifeomic/chromicons/blob/master/.github/chromicons@2x.png?raw=true" alt="Chromicons" width="300" />   </a> </p>
Author: LifeOmic
Latest version: 3.12.0

# Chromicons

<p align="center">
  <a href="https://github.com/lifeomic/chromicons">
    <img src="https://github.com/lifeomic/chromicons/blob/master/.github/chromicons@2x.png?raw=true" alt="Chromicons" width="300" />
  </a>
</p>

<br>

Handcrafted open source icons from LifeOmic. Ready to use in web, iOS, Android, and desktop apps. Completely open source, MIT licensed, and built with ♥️ by the team at LifeOmic.

## Usage

### npm package 📦

The recommended path for usage is via the package on npm.

1. Install Dependency

```bash
yarn add @lifeomic/chromicons
```

2. Import Icons!

```js
import { Apple } from '@lifeomic/chromicons';
```

**With React-Native**

1. Install Dependency

```bash
yarn add @lifeomic/chromicons-png
```

2. Import Icons!

Icon images are stored in the `lined` folder. Each icon has its own folder with images for different screen densities (@1x, @1.5x, @2x, ..., @4x). Usage:

```jsx
<Image
  style={{ height: 24, width: 24, tintColor: 'red' }}
  source={require('@lifeomic/chromicons-png/lined/apple/apple.png')}
/>
```

**With React-Native (react-native-svg)**

1. Install Dependencies

```bash
yarn add @lifeomic/chromicons-native
```

2. Import the Icon Components

```jsx
import { Apple } from '@lifeomic/chromicons-native';

<Apple stroke="red" />;
```

### Web App 💻

You can view and copy all of the SVGs to your clipboard via the [web app](https://lifeomic.github.io/chromicons.com/). It also provides a link to download all raw SVGs.

## Icon Requests

Have an icon you want designed? File a GitHub issue and we'd be happy to create it for you!
npm package: @lifeomic/cyclone
Description: Blow away those annoying cycles.
Author: LifeOmic
Latest version: 1.0.3

# cyclone

This package was inspired by logic added in certain LifeOmic repos
to check for cyclic dependencies and to enforce specific forbidden cyclic
imports. The logic used [madge](https://www.npmjs.com/package/madge)
to implement the functionality.

This package exists to avoid duplicating the exact same setup and
code in every repo that wants to check for cyclic dependencies.

## Usage

Install the package:

```
yarn add -D @lifeomic/cyclone
```

Add a `cyclone.config.json` file to the root of the project with the following
structure:

```json
{
  "targetDir": "./src",
  "disallowedDependencies": [
    {
      "from": {
        "value": "schema/",
        "negate": true,
        "caseInsensitive": true
      },
      "to": {
        "value": "generated/schema"
      }
    }
  ],
  "fileExtensions": [
    "ts",
    "js"
  ]
}
```

Run `yarn cyclone`. You probably want to add this to your lint step.

Blow away those cycles 🌪️

## Config Properties

- `targetDir`: the specific directory where the cycle checks/enforcements
  should happen.
- `disallowedDependencies`: an array of objects that define the explicit
  disallowed dependencies.
    - `from`: Object specifying the source of the forbidden dependency.
      - `value`: a regular expression that should match the directory or file
        that should not be allowed to import the `to` value.
      - `negate`: if true, the `value` regular expression will be negated.
      - `caseInsensitive`: if true, the `value` regular expression will be
        case insensitive.
    - `to`: Object specifying the destination of the forbidden dependency.
      - `value`: a regular expression that should match the directory or file
        that should not be allowed to be imported by the `from` value.
      - `negate`: if true, the `value` regular expression will be negated.
      - `caseInsensitive`: if true, the `value` regular expression will be
        case insensitive.
    - `message`: optional - a message to display when the forbidden dependency
      enforcement is violated.
- `fileExtensions`: optional - defaults to `["ts", "js"]`. These are valid file
  extensions used to find files in directories. Passed directly to madge.
npm package: @lifeomic/double-check
Description: This package provides a utility for comparing the behavior of two function invocations in parallel, using different arguments.
Author: LifeOmic
Latest version: 1.1.4

This package provides a utility for comparing the behavior of two function invocations in parallel, using different arguments.

It's especially useful for exercising the behavior of a certain block of code in a blue-green scenario, and comparing the results between a primary + secondary configuration.

## Installation

```
yarn add @lifeomic/double-check
```

## Usage

```typescript
import { compare } from '@lifeomic/double-check';

const response = await compare({
  configurations: {
    // Specify a primary configuration.
    primary: {
      databaseClient: primaryDatabaseClient,
    },
    // Specify an optional secondary configuration.
    secondary: {
      databaseClient: secondaryDatabaseClient,
    },
  },

  // Specify the operation you'd like to perform using the configuration.
  operation: ({ databaseClient }) => {
    return databaseClient.query('SELECT * FROM users');
  },

  // Specify a secondary timeout.
  cutoffSecondaryAfterMs: 300,
});

// The response contains:

// The primary result.
response.primaryResult;

// A comparison of the results, if a secondary configuration was specified.
//
// This report should be logged and examined over time to analyze similarity between
// the primary + secondary configurations.
response.report;

// The error from the secondary operation, if it failed.
response.secondaryError;
```
npm package: @lifeomic/dynamodb-dataloader
Description: A DataLoader that batches DynamoDB item lookups
Author: Matt Lavin
Latest version: 1.0.2

# dynamodb-dataloader

[![npm](https://img.shields.io/npm/v/@lifeomic/dynamodb-dataloader.svg)](https://www.npmjs.com/package/@lifeomic/dynamodb-dataloader)
[![Build Status](https://travis-ci.org/lifeomic/dynamodb-dataloader.svg?branch=master)](https://travis-ci.org/lifeomic/dynamodb-dataloader)
[![Greenkeeper badge](https://badges.greenkeeper.io/lifeomic/dynamodb-dataloader.svg)](https://greenkeeper.io/)

A DataLoader that batches requests for DynamoDB. The DataLoader can fetch items
from multiple tables at once so you should only need one instance per request.

You should be able to replace your calls to `dynamoClient.get` with
`loader.load` and automaticly switch your network calls from `GetItem` to
`BatchGetItem`.

NOTE: Make sure you update your IAM policy to allow `dynamodb:BatchGetItem` if
you have strict IAM policies

# Example code

```javascript
const { createDataLoader } = require('@lifeomic/dynamodb-dataloader');

// Once per request or scope that can share data access
const client = new AWS.DyanmoDB();
const loader = createDataLoader({ client });

// Once per item fetch
const item = await loader.load({
  table: 'your table name',
  key: { idAattribute: { S: 'some id' } }
});
```
npm package: @lifeomic/eslint-config-standards
Description: This repo contains [ESLint configurations](https://eslint.org/docs/developer-guide/shareable-configs) to help enforce code standards at LifeOmic.
Author: Development
Latest version: 4.3.1

This repo contains [ESLint configurations](https://eslint.org/docs/developer-guide/shareable-configs)
to help enforce code standards at LifeOmic.

## Usage

```
yarn add -D @lifeomic/eslint-config-standards
```

```javascript
// eslintrc.js
module.exports = {
  extends: ['@lifeomic/standards'],
  ...
}
```

or for a React project:

```javascript
// eslintrc.js
module.exports = {
  extends: ['@lifeomic/standards', '@lifeomic/standards/react'],
  ...
}
```

## Configurations
This package provides a handful of configurations:

- [`@lifeomic/standards`](lib/index.js)
- [`@lifeomic/standards/javascript`](lib/javascript.js)
- [`@lifeomic/standards/typescript`](lib/typescript.js)
- [`@lifeomic/standards/jest`](lib/jest.js)
- [`@lifeomic/standards/react`](lib/react.js)
npm package: @lifeomic/eslint-plugin-frontend
Description: > A repository containing custom ESLint rules for frontend LifeOmic projects
Author: Tony Ward
Latest version: 0.1.1

# eslint-plugin-frontend

> A repository containing custom ESLint rules for frontend LifeOmic projects

## 🚀 Usage

### 1. Install plugin

```shell
yarn add --dev @lifeomic/eslint-plugin-frontend
```

### 2. Modify your `.eslintrc.js`

```javascript
// .eslintrc.js
module.exports = {
  plugins: [
    // Add to plugins
    "@lifeomic/frontend",
  ],
  rules: {
    // Start defining rules
    "@lifeomic/frontend/require-react-intl-define-messages": "error",
  },
};
```
npm package: @lifeomic/eslint-plugin-i18next
Description: An ESLint plugin for validating i18next usage
Author: LifeOmic
Latest version: 2.0.1

This repository contains an ESLint plugin for validating usage of [`i18next`](https://github.com/i18next/i18next).

## Installation

```
yarn add -D @lifeomic/eslint-plugin-i18next
```

## Usage

```javascript
// .eslintrc.js
module.exports = {
  plugins: ['@lifeomic/i18next'],
  rules: {
    '@lifeomic/i18next/default-value': [
      'error',
      {
        /* optional options object */
      },
    ],
  },
};
```

## Rule Options

#### `default-value`

- `translateFunctionNames`: an array of translation function names to validate. Default is `['t']`
- `allowKeyOnly`: whether to allow e.g. `t('just-the-key')`. Default is `false`.
- `allowNestingInterpolation`: Whether to allow e.g. `{ defaultValue: 'some string $t(interpolated)' }`. Default is `false`.
- `nestingPrefix`: Used when `allowNestingInterpolation` is `false` to identify interpolated variables. Default is `"$t("`.
npm package: @lifeomic/eslint-plugin-node
Description: Shared ESLint configuration and rules for LifeOmic projects
Author: LifeOmic
Latest version: 2.0.1

eslint-plugin-node
==================

[![Build Status](https://travis-ci.org/lifeomic/eslint-plugin-node.svg?branch=master)](https://travis-ci.org/lifeomic/eslint-plugin-node)
[![Greenkeeper badge](https://badges.greenkeeper.io/lifeomic/eslint-plugin-node.svg)](https://greenkeeper.io/)

## Usage

Run `yarn add --dev @lifeomic/eslint-plugin-node`. Then update your ESLint
config to include `"extends": "plugin:@lifeomic/node/recommended"`.

More details can be found in the [ESLint documentation][config-from-plugins].

[config-from-plugins]: https://eslint.org/docs/user-guide/configuring#using-the-configuration-from-a-plugin "Using the configuration from a plugin"
npm package: @lifeomic/eslint-plugin-typescript
Description: LifeOmic config for typescript-eslint
Author: Xander Dumaine
Latest version: 0.1.1

# eslint-plugin-typescript

LifeOmic config for typescript-eslint

## Installation

Next, install `@lifeomic/eslint-plugin-typescript`:

```
yarn add -D @lifeomic/eslint-plugin-typescript --save-dev
```

## Usage

Add `typescript` to the plugins section of your `.eslintrc` configuration file.
You can omit the `eslint-plugin-` prefix:

```js
{
  plugins: ['@lifeomic/typescript'];
}
```

Add the recommended config and rules to your `extends`:

```js
{
    extends: ['plugin:@lifeomic/typescript/recommended']
}

```

There's an optional `reactNative` config which provides some helpers for
reactNative.

**NOTE:** These make use of the `@typescript-eslint/eslint-plugin-tslint`
plugin, which _does not like_ to be run on non-typescript files, or files not
included in a project. That means if you have js files, or ts files outside of a
helper included in your lint config, you can do something like this:

```js
const lifeomicTypescript = require('@lifeomic/eslint-plugin-typescript');
const reactNative = lifeomicTypescript.configs.reactNative;

...

  overrides: [
    {
      // src files
      files: ['src/**/*.{ts,tsx}', 'typings/**/*.ts'],
      excludedFiles: [
        'src/**/*.test.{tsx,ts}',
        'src/{testUtils,utils/__mocks__}/**/*'
      ],
      env: {
        node: false,
        browser: true
      },
      rules: {
          ...reactNative.rules // only add these rules to source files
      }
    }
  ]

...
```
npm package: @lifeomic/gradual-feature-toggle-tools
Description: Provides a set of helper functions to make gradual, non-binary, feature toggle use easier
Author: Matt Lavin
Latest version: 1.0.0

gradual-feature-toggle-tools
============================

[![npm](https://img.shields.io/npm/v/@lifeomic/gradual-feature-toggle-tools.svg)](https://www.npmjs.com/package/@lifeomic/gradual-feature-toggle-tools)
[![Build Status](https://travis-ci.org/lifeomic/gradual-feature-toggle-tools.svg?branch=master)](https://travis-ci.org/lifeomic/gradual-feature-toggle-tools)
[![Greenkeeper badge](https://badges.greenkeeper.io/lifeomic/gradual-feature-toggle-tools.svg)](https://greenkeeper.io/)

A set of tools to make gradual rollout of features easier

Selecting users to get a feature
--------------------------------

When a new feature is being rolled out and is currently 50% enabled, then
ideally 50% of the users would get the new behavior. The enablement of the new
behavior should be uniform as the feature value is increased and should not be
biased by the usernames or feature names. For example, if you use e-mail
addresses then ideally the enablement of `@gmail.com` users would be evenly
spread across the range of enablement. The testcases assert that uniform
distribution is true.

Given a feature an a user, this code can help you decide whether a user should
receive the new behavior or not:

```js
import { calculateUserEnablementThreshold } from 'gradual-feature-toggle-tools';

const featureValue = // some lookup of a feature's current value (from 0 - 100)
const userThreshold = await calculateUserEnablementThreshold('some-feature', 'some-user');
if (featureValue > userThredshold) {
    // Use the new behavior
} else {
    // Use the old behavior
}
```
npm package: @lifeomic/graphql-directive-retry
Description: A GraphQL schema directive to retry resolvers
Author: LifeOmic
Latest version: 1.0.2

# graphql-directive-retry

[![npm](https://img.shields.io/npm/v/@lifeomic/graphql-directive-retry.svg)](https://www.npmjs.com/package/@lifeomic/graphql-directive-retry)
[![Greenkeeper badge](https://badges.greenkeeper.io/lifeomic/graphql-directive-retry.svg)](https://greenkeeper.io/)
[![Build Status](https://travis-ci.org/lifeomic/graphql-directive-retry.svg?branch=master)](https://travis-ci.org/lifeomic/graphql-directive-retry)
[![Coverage Status](https://coveralls.io/repos/github/lifeomic/graphql-directive-retry/badge.svg?branch=master)](https://coveralls.io/github/lifeomic/graphql-directive-retry?branch=master)

Instead of adding retry logic inside the resolver implementation, use this
schema directive to add retry declaratively

## Usage

```js
const { retryDirective, retryDeclaration } = require('@lifeomic/graphql-directive-retry');
const { makeExecutableSchema } = require('graphql-tools');
const { graphql } = require('graphql');

const typeDefs = `
  ${retryDeclaration('retry')}

  type Query {
    flakyFunction(arg: String!): String! @retry(maxTimeout: 100)
  }
`;
```

### Customizing timeout behavior

This directive is based on [promise-retry](https://github.com/IndigoUnited/node-promise-retry#readme)
and you can use the same configuration options.

#### Field Config

You can configure retry behavior on a per-field basis like this:

```
type Query {
  flakyFunction(arg: String!): String!
    @retry(retries: 1, minTimeout: 100, maxTimeout: 200, factor: 1.1)
}
```

#### Global Config

You can configure the default retry behavior for all resovlers with a retry
directive by providing the configuration in the execution context. Here is
an example:

```js
const response = await graphql(
  yourSchema,
  yourQuery,
  rootObject,
  {
    ... yourContext
    retryDirectiveConfig: {
      retries: 0
    }
  },
  {}
);
```
npm package: @lifeomic/igv
Description: igv.js =======
Author: Jim Robinson
Latest version: 0.6.1

igv.js
=======


igv.js is an embeddable interactive genome visualization component.  It is based on the desktop [Integrative Genomics Viewer (IGV)](http://www.broadinstitute.org/igv), and developed by the same team.

See the [Wiki](https://github.com/igvteam/igv.js/wiki) for more information.
npm package: @lifeomic/jest-config
Description: Shared Jest config utils etc.
Author: Development
Latest version: 2.0.0

# jest-config
Shared Jest config utils etc.

## preset
Publish a preset file for jest. Jest [29](https://jestjs.io/docs/29.x/configuration#preset-string)

```json
{
  "preset": "@lifeomic/jest-config"
}
```

Config was extracted from [lifeomic/typescript-tools](https://github.com/lifeomic/typescript-tools/blob/e38d833a27a04122856fbd5c939f2e26c9bd02d5/config/jest.js)

## expect enhancement
Matchers can be exposed at the root level.  The library needs to be imported at some level to work.

[Jest-extended setup instructions](https://github.com/jest-community/jest-extended#setup)

```json
{
  "setupFiles": ["@lifeomic/jest-config"]
}
```

OR 

```json
{
  "setupFilesAfterEnv": ["@lifeomic/jest-config"]
}
```

The project can also be imported inside internal setup/test files using a setup file.
`setup.ts`
```typescript
import ('@lifeomic/jest-config');
```

To get typescript to see the types, it has been necessary to include something in the `tsconfig.json`.

```json
{
  "include": [
    "setup.ts"
  ]
}
```

After importing, all matchers are now exposed at the root level, and can be not-ed.

```typescript
test('has exposed some desired methods', () => {
  expect({
    numberVal: .31,
    otherNum: .3,
  }).toEqual({
    numberVal: expect.toBeCloseTo(0.3, 1),
    otherNum: expect.not.toBeCloseTo(0.2),
  });
});
```
npm package: @lifeomic/json-schema-to-graphql-types
Description: A utility to convert JSON Schema types into GraphQL types
Author: LifeOmic
Latest version: 1.4.2

JSON Schema to GraphQL Types Converter
======================================
[![Greenkeeper badge](https://badges.greenkeeper.io/lifeomic/json-schema-to-graphql-types.svg)](https://greenkeeper.io/)
[![Build Status](https://travis-ci.org/lifeomic/json-schema-to-graphql-types.svg?branch=master)](https://travis-ci.org/lifeomic/json-schema-to-graphql-types)
[![Coverage Status](https://coveralls.io/repos/github/lifeomic/json-schema-to-graphql-types/badge.svg?branch=master)](https://coveralls.io/github/lifeomic/json-schema-to-graphql-types?branch=master)

This tools will convert a directory of JSON Schemas into set of GraphQL types.
To use it, do the following:

    npm install -g @lifeomic/json-schema-to-graphql-types
    convert-json-schemas-to-graphql-types <some-dir-with-json-schemas>

When that is run, the tool will output a list of GraphQL types that match the
types in the JSON schemas. After generating the types, you'll need to create
Query and Mutation types to complete you schema and then add resolvers as
needed.
npm package: @lifeomic/jupyterlab-toolbrowser
Description: A JupyterLab extension to display, filter and allow download of notebooks from the Precision Health Cloud Tool Registry.
Author: lifeomic
Latest version: 1.0.1

# jupyterlab-toolbrowser

![Github Actions Status](https://github.com/lifeomic/jupyterlab-toolbrowser/workflows/Build/badge.svg)

A JupyterLab extension to display, filter and allow download of notebooks from the Precision Health Cloud Tool Registry.

## Requirements

* JupyterLab >= 2.0
* Precision Health Cloud

## Install

```bash
jupyter labextension install @lifeomic/jupyterlab-toolbrowser
```
### Uninstall

```bash
jupyter labextension uninstall @lifeomic/jupyterlab-toolbrowser
```
npm package: @lifeomic/react-native-calendar
Description: React Native components for rendering calendars
Author: LifeOmic
Latest version: 3.0.0

Customizable cross-platform React Native components for rendering calendars. Works out-of-the-box on iOS, Android, and Web.

![example](./example.gif)

## Usage

```
yarn add @lifeomic/react-native-calendar
```

See the in-line JSDoc for documentation on specific props.

```tsx
import { Calendar } from '@lifeomic/react-native-calendar';

const App = () => {
  const [events, setEvents] = React.useState([
    {
      id: 'event-one',
      title: 'Event One',
      startDate: new Date(),
      endDate: new Date(),
    },
  ]);

  return (
    <Calendar
      startDate={new Date()}
      events={events}
      onGridPress={(e, date) => {
        setEvents([
          ...events,
          {
            id: 'new-event',
            title: 'New Event',
            startDate: date,
            endDate: new Date(),
          },
        ]);
      }}
      onEventPress={(event) => {
        alert('Pressed event: ' + event.title);
      }}
    />
  );
};
```

### Customized Styling

To override the styling of the calendar, check out the `colors` and `renderers` props:

```tsx
<Calendar
  renderers={{
    eventContent: () => {
      // Render custom UI for events.
      return <View>{...}</View>
    }
  }}
  // Customize the colors of various built-in views.
  colors={{
    event: 'red'
  }}
/>
```
npm package: @lifeomic/runtime-tool-graphql-transforms
Description: [![npm](https://img.shields.io/npm/v/@lifeomic/runtime-tool-graphql-transforms.svg)](https://www.npmjs.com/package/@lifeomic/runtime-tool-graphql-transforms) [![Build Status](https://github.com/lifeomic/runtime-tools/actions/workflows/release.yaml/badge.s
Author: LifeOmic
Latest version: 0.0.0

# @lifeomic/runtime-tool-graphql-transforms

[![npm](https://img.shields.io/npm/v/@lifeomic/runtime-tool-graphql-transforms.svg)](https://www.npmjs.com/package/@lifeomic/runtime-tool-graphql-transforms)
[![Build Status](https://github.com/lifeomic/runtime-tools/actions/workflows/release.yaml/badge.svg)](https://github.com/lifeomic/runtime-tools/actions/workflows/release.yaml)
[![Coverage Status](https://coveralls.io/repos/github/lifeomic/runtime-tools/badge.svg?branch=master)](https://coveralls.io/github/lifeomic/runtime-tools?branch=master)


This project holds GraphQL transforms with only dependencies on graphql and
@graphql-tools packages
npm package: @lifeomic/semantic-release-actions-tagging
Description: A [`semantic-release`](https://github.com/semantic-release/semantic-release) plugin for creating Git tags matching GitHub Actions convention. Use this plugin if you want to use semantic-release to version your custom GitHub Actions.
Author: LifeOmic
Latest version: 1.0.1

A [`semantic-release`](https://github.com/semantic-release/semantic-release) plugin for creating Git tags matching GitHub Actions convention. Use this plugin if you want to use semantic-release to version your custom GitHub Actions.

## Installation

```
yarn add -D @lifeomic/semantic-release-actions-tagging
```

## Usage

```js
// release.config.js
module.exports = {
  branches: ['master'],
  plugins: [
    ['@semantic-release/commit-analyzer', { preset: 'conventionalcommits' }],
    // Declare here.
    '@lifeomic/semantic-release-actions-tagging',
  ],
};
```

## Behavior

The config above will cause major + minor tags to be created when releasing a new version.

e.g. if your recent commits will result in a new `v1.2.3` version being published, this plugin will also:

- create a new (or move an existing) `v1` tag pointed to the same commit
- create a new (or move an existing) `v1.2` tag pointed to the same commit
npm package: @lifeomic/test-tool-docker
Description: [![npm](https://img.shields.io/npm/v/@lifeomic/test-tool-docker.svg)](https://www.npmjs.com/package/@lifeomic/test-tool-docker) [![Build Status](https://github.com/lifeomic/test-tools/actions/workflows/release.yaml/badge.svg)](https://github.com/lifeomic/
Author: LifeOmic
Latest version: 5.2.1

# @lifeomic/test-tool-docker

[![npm](https://img.shields.io/npm/v/@lifeomic/test-tool-docker.svg)](https://www.npmjs.com/package/@lifeomic/test-tool-docker)
[![Build Status](https://github.com/lifeomic/test-tools/actions/workflows/release.yaml/badge.svg)](https://github.com/lifeomic/test-tools/actions/workflows/release.yaml)

Convenience methods for interacting with Docker

[executeContainerCommand](#executeContainerCommand)
[pullImage](#pullImage)
[imageExists](#imageExists)
[ensureImage](#ensureImage)
[getHostAddress](#getHostAddress)

## Container

### executeContainerCommand

Executes the container with several convenience options.

| ExecuteCommandConfig | Description                                                                                      |
|----------------------|--------------------------------------------------------------------------------------------------|
| container            | A [dockerode](dockerode) container                                                               |
| command              | The command to be sent to the container                                                          |
| environment          | environment variables to be sent to the container.  Should be in the format `ENV_NAME=ENV_VALUE` |
| stdin?               | If set then the string is sent as an end command to the container stream                         |


## Image

### pullImage

Pulls the image into the current Docker environment

| arg    | Description                                    |
|--------|------------------------------------------------|
| docker | A [dockerode](dockerode) instance              |
| image  | The image to be pulled. `<image-name>[:<tag>]` |

### imageExists

Returns if the image exists in the local docker environment.

| arg    | Description                                     |
|--------|-------------------------------------------------|
| docker | A [dockerode](dockerode) instance               |
| image  | The image to be checked. `<image-name>[:<tag>]` |

### ensureImage

Will pull the image from the remote repository if it isn't already present locally.

| arg    | Description                                     |
|--------|-------------------------------------------------|
| docker | A [dockerode](dockerode) instance               |
| image  | The image to be checked. `<image-name>[:<tag>]` |


## Utility methods

### getHostAddress

Will return the Docker host address.

If `process.env.DOCKER_HOST_ADDR` is set, then that value will be returned.

When running on MacOS and `require('os').type() === 'Darwin'` then '127.0.0.1' will be returned.

Otherwise, we will start up an alpine image and return the default inet address.

[dockerode](https://github.com/apocas/dockerode)
npm package: @lifeomic/test-tool-lambda
Description: [![npm](https://img.shields.io/npm/v/@lifeomic/test-tool-lambda.svg)](https://www.npmjs.com/package/@lifeomic/test-tool-lambda) [![Build Status](https://github.com/lifeomic/test-tools/actions/workflows/release.yaml/badge.svg)](https://github.com/lifeomic/
Author: LifeOmic
Latest version: 5.2.1

# @lifeomic/test-tool-lambda

[![npm](https://img.shields.io/npm/v/@lifeomic/test-tool-lambda.svg)](https://www.npmjs.com/package/@lifeomic/test-tool-lambda)
[![Build Status](https://github.com/lifeomic/test-tools/actions/workflows/release.yaml/badge.svg)](https://github.com/lifeomic/test-tools/actions/workflows/release.yaml)

## Lambda convenience methods

### Create

`createFunction` takes care of some of the configuration settings for localstack.

```typescript
import { createFunction } from '@lifeomic/test-tool-lambda';

// Just an example, make sure you are pointing to the correct zip file.
const zipFilePath = path.join(__dirname, '../../../deploy/terraform/build/myFunctionFile.zip');

await createFunction({
  FunctionName: 'myFunction',
  Runtime: 'nodejs18.x',
  MemorySize: 1024,
  Timeout: 10,
  Handler: 'myFunctionFile.handlerFunctionName',
  zipFilePath,
  env: {
    LAMBDA_ENDPOINT: 'http://mockserver:1080/lambda',
  }
});
```

### Test Hooks

`lambdaHooks` provides some convenience around test before/after stuff.  It can be used in a global/file/test centric way.
The `uniqueNames` boolean causes the lib to create unique functions for every `before` call.  This can be useful if you 
want unique lambdas per test/file.

```typescript
import { lambdaHooks } from '@lifeomic/test-tool-lambda';

// Just an example, make sure you are pointing to the correct zip file.
const zipFilePath = path.join(__dirname, '../../../deploy/terraform/build/myFunctionFile.zip');

const hooks = lambdaHooks({
  uniqueNames: true,
  lambdas: [{
    functionName: 'myFunction',
    Runtime: 'nodejs18.x',
    MemorySize: 1024,
    Timeout: 10,
    Handler: 'myFunctionFile.handlerFunctionName',
    zipFilePath,
    env: {
      LAMBDA_ENDPOINT: 'http://mockserver:1080/lambda',
    }
  }],
});

// Calls out to AWS api until ListFunctionsCommand returns successfully
await hooks.beforeAll();

// Creates the lambdas defined above, and returns an object with `[functionName]: possiblyUniqueFunctionName`
const context = await hooks.before();
const functionName = context.functionName;

// Calls Lambda.deleteFunction
await hooks.after();

// Destroys the client, closing any open sockets.
await hooks.afterAll();
```
npm package: @lifeomic/test-tool-localstack
Description: [![npm](https://img.shields.io/npm/v/@lifeomic/test-tool-localstack.svg)](https://www.npmjs.com/package/@lifeomic/test-tool-localstack) [![Build Status](https://github.com/lifeomic/test-tools/actions/workflows/release.yaml/badge.svg)](https://github.com/l
Author: LifeOmic
Latest version: 5.2.1

# @lifeomic/test-tool-localstack

[![npm](https://img.shields.io/npm/v/@lifeomic/test-tool-localstack.svg)](https://www.npmjs.com/package/@lifeomic/test-tool-localstack)
[![Build Status](https://github.com/lifeomic/test-tools/actions/workflows/release.yaml/badge.svg)](https://github.com/lifeomic/test-tools/actions/workflows/release.yaml)

Localstack docker setup and run tools.

## startLocalstackDocker

Starts up a localstack docker instance with specified services.

`LocalstackConnectionOptions`

| Option (default)      | Description                                                                                                                                                                                                                              |
|-----------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| versionTag = 0.14     | Which version of [localstack](https://hub.docker.com/r/localstack/localstack/tags) to use, must be >= 0.12.20.  Not allowed to be latest.                                                                                                |
| nameTag = ''          | Which of the three variants to use, `light` or `full`, with nothing specified defaulting to the `localstack/localstack` default which is light                                                                                           |
| services              | A list of [SERVICES](https://docs.localstack.cloud/localstack/configuration/) to start.  Comma-separated list of [AWS CLI service names or shorthands](http://docs.aws.amazon.com/cli/latest/reference/#available-services) to start up. |
| envVariables          | Other [environment variables](https://docs.localstack.cloud/localstack/configuration/) to start the localstack instance with                                                                                                             |
| localstackPort = 4566 | Tell Localstack which port to use.  Should probably use different ones when running on CI systems                                                                                                                                        |

Returns a `LocalstackConnection` type.

```typescript
interface LocalstackConnection extends awsUtils.ConnectionAndConfig {
  getOutput: () => string;
  clearOutput: () => void;
  cleanup: () => Promise<void>;
}
```

## Hooks

Test framework convenience method.

```typescript
import { localstackHooks } from '@lifeomic/test-tool-localstack'

const hooks = localstackHooks();
let

beforeAll(async () => {
  
})
```
npm package: @lifeomic/test-tool-mockserver
Description: [![npm](https://img.shields.io/npm/v/@lifeomic/test-tool-mockserver.svg)](https://www.npmjs.com/package/@lifeomic/test-tool-mockserver) [![Build Status](https://github.com/lifeomic/test-tools/actions/workflows/release.yaml/badge.svg)](https://github.com/l
Author: LifeOmic
Latest version: 5.2.1

# @lifeomic/test-tool-mockserver

[![npm](https://img.shields.io/npm/v/@lifeomic/test-tool-mockserver.svg)](https://www.npmjs.com/package/@lifeomic/test-tool-mockserver)
[![Build Status](https://github.com/lifeomic/test-tools/actions/workflows/release.yaml/badge.svg)](https://github.com/lifeomic/test-tools/actions/workflows/release.yaml)

## MockServer Client

Some mockserver-client helpers.

```typescript
import {
  mockInvocation,
  verifyInvocation,
} from '@lifeomic/test-tool-mockserver';
```

### mockInvocation
Mocks the AWS Lambda service level calls. Very useful when combined with [localstack](https://localstack.cloud/)
invoking lambdas.  The service level interactions are handled by the method call, and the consumer provides
the lambda invocation request/response payload.

```typescript
const functionName = 'my-function-name';
const expectedResponse = { verifyResponse: 'result' };
const expectedRequestBody = { verifyRequest: 'value' };
await mockInvocation(mockServerClient, functionName, expectedResponse, expectedRequestBody);
// Invoke so that we can retest verify after invocation
await lambdaV2.invoke({
  FunctionName: functionName,
  Payload: JSON.stringify(expectedRequestBody),
}).promise();
```

### verifyInvocation
Verify that the lambda mock service was invoked with the expected body.

```typescript
// Verifying one invocation should succeed now
await verifyInvocation(mockServerClient, functionName, expectedRequestBody, 1);
```
npm package: @lifeomic/test-tool-utils
Description: [![npm](https://img.shields.io/npm/v/@lifeomic/test-tool-utils.svg)](https://www.npmjs.com/package/@lifeomic/test-tool-utils) [![Build Status](https://github.com/lifeomic/test-tools/actions/workflows/release.yaml/badge.svg)](https://github.com/lifeomic/te
Author: LifeOmic
Latest version: 5.2.1

# @lifeomic/test-tool-utils

[![npm](https://img.shields.io/npm/v/@lifeomic/test-tool-utils.svg)](https://www.npmjs.com/package/@lifeomic/test-tool-utils)
[![Build Status](https://github.com/lifeomic/test-tools/actions/workflows/release.yaml/badge.svg)](https://github.com/lifeomic/test-tools/actions/workflows/release.yaml)

# logging

Exposes a [debug](debug) instance for the named library

```typescript
export interface Logger {
  info: Debugger;
  error: Debugger;
  warn: Debugger;
  debug: Debugger;
  child(name: string): Logger;
}
```

```typescript
import { logging } from '@lifeomic/test-tool-utils';

const logger = logging.getLogger('my-lib');


```

# writeBuffer

An array backed buffer for streams.  Especially useful for handling Docker streams.

```typescript
import { writeBuffer } from '@lifeomic/test-tool-utils';

...
const stderr = new writeBuffer.WriteBuffer();
const stdout = new writeBuffer.WriteBuffer();
container.modem.demuxStream(stream, stdout, stderr);
...

console.info(stdout.toString('utf-8'));
console.error(stderr.toString('utf-8'));
```


[debug](https://www.npmjs.com/package/debug)
npm package: @lifeomic/tipsi-stripe
Description: React Native Stripe binding for iOS/Andriod platforms
Author: Tipsi
Latest version: 7.7.10

# @lifeomic/tipsi-stripe

[![npm version](https://img.shields.io/npm/v/@lifeomic/tipsi-stripe?color=neon&style=flat-square)](https://www.npmjs.com/package/@lifeomic/tipsi-stripe)
[![travis ci](https://img.shields.io/travis/lifeomic/tipsi-stripe)](https://travis-ci.org/lifeomic/tipsi-stripe)

React Native Stripe binding for iOS/Android platforms

## Installation

```
yarn add @lifeomic/tipsi-stripe
```

## Improvements

- TypeScript support

- iOS Credit Card input fix (tipsi/tipsi-stripe#408)

## License

tipsi-stripe is available under the MIT license. See the [LICENSE](https://github.com/tipsi/tipsi-stripe/tree/master/LICENSE) file for more info. This fork is also available under the MIT license ([LICENSE](https://github.com/lifeomic/tipsi-stripe/tree/master/LICENSE)).