# featureflags-client

> GRPC node client for feacture flags service

Latest version **1.0.3** (published 2019-05-07) · ISC license · 0 weekly downloads

## Install

```sh
npm install featureflags-client
pnpm add featureflags-client
yarn add featureflags-client
bun add featureflags-client
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2019-05-07 |
| First published | 2019-05-07 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=10.0.0 |
| Dependencies | 3 |
| Unpacked size | 546.2 KB |
| Known vulnerabilities | 0 (+6 in 1 direct dependencies) |
| Install scripts | no |
| Author | d.medvinskiy |
| Maintainers | amostovenko |

## Links

- npm: https://www.npmjs.com/package/featureflags-client
- npm.io page: https://npm.io/package/featureflags-client

## Dependencies (3)

- [@evo/logevo](https://npm.io/package/@evo/logevo.md) 1.0.8
- [@grpc/grpc-js](https://npm.io/package/@grpc/grpc-js.md) 0.3.6
- [@grpc/proto-loader](https://npm.io/package/@grpc/proto-loader.md) 0.5.0

## Recent versions

- 1.0.3 (latest) — 2019-05-07
- 1.0.2 — 2019-05-07
- 1.0.1 — 2019-05-07

## README

# Feature Flags client
NodeJS client `grpc` lib, for [featureflags](https://gitlab.evo.dev/service/featureflags) service. Provides abilitty to gracefull *set* and *update*s
for ur features.

> `.proto` files were taken directly from repo above.
> They should be uploaded in some place from the root repo on `deploy` i guess

## API
`FeatureClient` is the base class. With it's constructor u will init `grpc` client, wich will call `ExchangeRequest`
every 5 min. in *async* manner. So it shouldn't hurt ur `eventloop` much, or app performance, coz of inmemory caching and time interval.

So u do this on application start:
```js
import { FeatureClient, Variable, Types } from '@evo/featureflags-client';

// Ur default flags dict
const Flags = {
  TEST: false,
  NODE: false
};

const featureClient = new FeatureClient(
  'thecorp', // project name
  'grpc:50051', // grpc-url
  Flags, // default flags
  [
    new Variable('username', Types.STRING) // ur controll values for Checks
  ],
  true, // isDebugg mode
);
```

In ur controllers, or somewhere when ur need ur features to work properly,
call `getFlags`, and provide there `context = {}`. Ctx is the object with `Variable` as a key,
and a value u want checks to depend on.

```js
import { getFlags } from '@evo/featureflags-client';

// ready to use object with proceeded checks
const flags = getFlags({ username: 'Petro' });

if (flags.TEST) doSomeThing();
```

### Left to implement
There several features, that exists in python [flags.lib](https://gitlab.evo.dev/service/featureflags/tree/master/client)
, that u are free to extend:

- *StatsController* - Accumulates interval/flag/requests count
- *Tracer* - Accumulates request/flag/values

---
_Source: https://npm.io/package/featureflags-client · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
