Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

unleash-client

Unleash1.3mApache-2.06.6.0TypeScript support: included

Unleash Client for Node

unleash, client, feature toggle

readme

Unleash Client SDK for Node.js

Unleash node SDK on npm npm downloads Build Status Code Climate Coverage Status

Unleash is a private, secure, and scalable feature management platform built to reduce the risk of releasing new features and accelerate software development. This server-side Node.js SDK is designed to help you integrate with Unleash and evaluate feature flags inside your application.

You can use this client with Unleash Enterprise or Unleash Open Source.

Getting started

1. Install the Unleash client in your project

npm install unleash-client

or

yarn add unleash-client

(Or any other tool you like.)

2. Initialize unleash-client

Once installed, you must initialize the SDK in your application. By default, Unleash initialization is asynchronous, but if you need it to be synchronous, you can block until the SDK has synchronized with the server.

Note that until the SDK has synchronized with the API, all features will evaluate to false unless you have a bootstrapped configuration.


💡 Tip: All code samples in this section will initialize the SDK and try to connect to the Unleash instance you point it to. You will need an Unleash instance and a server-side API token for the connection to be successful.


We recommend that you initialize the Unleash client SDK as early as possible in your application. The SDK will set up an in-memory repository and poll for updates from the Unleash server at regular intervals.

import { initialize } from 'unleash-client';

const unleash = initialize({
  url: 'https://YOUR-API-URL',
  appName: 'my-node-name',
  customHeaders: { Authorization: '<YOUR_API_TOKEN>' },
});

The initialize function will configure a global Unleash instance. If you call this method multiple times, the global instance will be changed. You will not create multiple instances.

How do I know when it's ready?

Because the SDK takes care of talking to the server in the background, it can be difficult to know exactly when it has connected and is ready to evaluate toggles. If you want to run some code when the SDK becomes ready, you can listen for the 'synchronized' event:

unleash.on('synchronized', () => {
  // the SDK has synchronized with the server
  // and is ready to serve
});

Refer to the events reference later in this document for more information on events and an exhaustive list of all the events the SDK can emit.

The initialize function will configure and create a global Unleash instance. When a global instance exists, calling this method has no effect. Call the destroy function to remove the globally configured instance.

Constructing the Unleash client directly

You can also construct the Unleash instance yourself instead of via the initialize method.

When using the Unleash client directly, you should not create new Unleash instances on every request. Most applications are expected to only have a single Unleash instance (singleton). Each Unleash instance will maintain a connection to the Unleash API, which may result in flooding the Unleash API.

import { Unleash } from 'unleash-client';

const unleash = new Unleash({
  url: 'https://YOUR-API-URL',
  appName: 'my-node-name',
  customHeaders: { Authorization: '<YOUR_API_TOKEN>' },
});

unleash.on('ready', console.log.bind(console, 'ready'));

// optional error handling when using unleash directly
unleash.on('error', console.error);

Synchronous initialization

You can also use the startUnleash function and await to wait for the SDK to have fully synchronized with the Unleash API. This guarantees that the SDK is not operating on local and potentially stale feature toggle configuration.

import { startUnleash } from 'unleash-client';

const unleash = await startUnleash({
  url: 'https://YOUR-API-URL',
  appName: 'my-node-name',
  customHeaders: { Authorization: '<YOUR_API_TOKEN>' },
});

// The Unleash SDK now has a fresh state from the Unleash API
const isEnabled = unleash.isEnabled('Demo');

3. Check features

With the SDK initialized, you can use it to check the states of your feature toggles in your application.

The primary way to check feature toggle status is to use the isEnabled method on the SDK. It takes the name of the feature and returns true or false based on whether the feature is enabled or not.

setInterval(() => {
  if (unleash.isEnabled('DemoToggle')) {
    console.log('Toggle enabled');
  } else {
    console.log('Toggle disabled');
  }
}, 1000);

👀 Note: In this example, we've wrapped the isEnabled call inside a setInterval function. In the event that all your app does is start the SDK and check a feature status, this setup ensures that the node app keeps running until the SDK has synchronized with the Unleash API. It is not required in normal apps.

Check variants

You can use the getVariant method to retrieve the variant of a feature flag. If the flag is disabled or doesn't have any variants, the method returns the disabled variant.

const variant = unleash.getVariant('demo-variant');

if (variant.name === 'blue') {
  // do something with the blue variant...
}

Providing an Unleash context

Calling the isEnabled method with just a feature name will work in simple use cases, but in many cases you'll also want to provide an Unleash context. The SDK uses the Unleash context to evaluate any activation strategy with strategy constraints, and also to evaluate some of the built-in strategies.

The isEnabled accepts an Unleash context object as a second argument:

const unleashContext = {
  userId: '123',
  sessionId: 'some-session-id',
  remoteAddress: '127.0.0.1',
  properties: {
    region: 'EMEA',
  },
};

const enabled = unleash.isEnabled('someToggle', unleashContext);

4. Stop unleash

To shut down the client (turn off the polling) you can simply call the destroy method. This is typically not required.

import { destroy } from 'unleash-client';
destroy();

Built-in activation strategies

The client supports all built-in activation strategies provided by Unleash.

Read more about activation strategies in the official docs.

Unleash context

In order to use some of the common activation strategies you must provide an Unleash context. This client SDK allows you to send in the unleash context as part of the isEnabled call:

const unleashContext = {
  userId: '123',
  sessionId: 'some-session-id',
  remoteAddress: '127.0.0.1',
};
unleash.isEnabled('someToggle', unleashContext);

Advanced usage

The initialize method takes the following arguments:

  • url - The url to fetch toggles from (required).
  • appName - The application name / codebase name (required).
  • environment - The value to put in the Unleash context's environment property. Automatically populated in the Unleash Context (optional). This does not set the SDK's Unleash environment.
  • instanceId - A unique identifier, should/could be somewhat unique.
  • refreshInterval - The poll interval to check for updates. Defaults to 15000ms.
  • metricsInterval - How often the client should send metrics to Unleash API. Defaults to 60000ms.
  • strategies - Custom activation strategies to be used.
  • disableMetrics - Disable metrics.
  • customHeaders - Provide a map(object) of custom headers to be sent to the unleash-server.
  • customHeadersFunction - Provide a function that returns a Promise resolving as custom headers to be sent to unleash-server. When options are set, this will take precedence over customHeaders option.
  • timeout - Specify a timeout in milliseconds for outgoing HTTP requests. Defaults to 10000ms.
  • repository - Provide a custom repository implementation to manage the underlying data.
  • httpOptions - Provide custom HTTP options such as rejectUnauthorized - be careful with these options as they may compromise your application security.
  • namePrefix - Only fetch feature toggles with the provided name prefix.
  • tags - Only fetch feature toggles tagged with the list of tags, such as: [{type: 'simple', value: 'proxy'}].

Custom strategies

1. Implement the custom strategy

import { initialize, Strategy } from 'unleash-client';
class ActiveForUserWithEmailStrategy extends Strategy {
  constructor() {
    super('ActiveForUserWithEmail');
  }

  isEnabled(parameters, context) {
    return parameters.emails.indexOf(context.email) !== -1;
  }
}

2. Register your custom strategy

initialize({
  url: 'http://unleash.herokuapp.com',
  customHeaders: {
    Authorization: 'API token',
  },
  strategies: [new ActiveForUserWithEmailStrategy()],
});

Events

The unleash instance object implements the EventEmitter class and emits the following events:

event payload description
ready - is emitted once the fs-cache is ready. if no cache file exists it will still be emitted. The client is ready to use, but might not have synchronized with the Unleash API yet. This means the SDK still can operate on stale configurations.
synchronized - is emitted when the SDK has successfully synchronized with the Unleash API, or when it has been bootstrapped, and has all the latest feature toggle configuration available.
registered - is emitted after the app has been registered at the API server
sent object data key/value pair of delivered metrics
count string name, boolean enabled is emitted when a feature is evaluated
warn string msg is emitted on a warning
error Error err is emitted on an error
unchanged - is emitted each time the client gets new toggle state from server, but nothing has changed
changed object data is emitted each time the client gets new toggle state from server and changes have been made
impression object data is emitted for every user impression (isEnabled / getVariant)

Example usage:

import { initialize } from 'unleash-client';

const unleash = initialize({
  appName: 'my-app-name',
  url: 'http://unleash.herokuapp.com/api/',
  customHeaders: {
    Authorization: 'API token',
  },
});

// Some useful life-cycle events
unleash.on('ready', console.log);
unleash.on('synchronized', console.log);
unleash.on('error', console.error);
unleash.on('warn', console.warn);

unleash.once('registered', () => {
  // Do something after the client has registered with the server API.
  // Note: it might not have received updated feature toggles yet.
});

unleash.once('changed', () => {
  console.log(`Demo is enabled: ${unleash.isEnabled('Demo')}`);
});

unleash.on('count', (name, enabled) => console.log(`isEnabled(${name})`));

Bootstrap

Available from v3.11.x

The Node.js SDK supports a bootstrap parameter, allowing you to load the initial feature toggle configuration from somewhere else than the Unleash API. The bootstrap data can be provided as an argument directly to the SDK, as a filePath to load, or as a url to fetch the content from. Bootstrap is a convenient way to increase resilience, where the SDK can still load fresh toggle configuration from the bootstrap location, even if the Unleash API should be unavailable at startup.

1. Bootstrap with data passed as an argument

const client = initialize({
  appName: 'my-application',
  url: 'https://app.unleash-hosted2.com/demo/api/',
  customHeaders: { Authorization: '<YOUR_API_TOKEN>' },
  bootstrap: {
    data: [
      {
        enabled: false,
        name: 'BootstrapDemo',
        description: '',
        project: 'default',
        stale: false,
        type: 'release',
        variants: [],
        strategies: [{ name: 'default' }],
      },
    ],
  },
});

2. Bootstrap via a URL

const client = initialize({
  appName: 'my-application',
  url: 'https://app.unleash-hosted.com/demo/api/',
  customHeaders: { Authorization: '<YOUR_API_TOKEN>' },
  bootstrap: {
    url: 'http://localhost:3000/proxy/client/features',
    urlHeaders: {
      Authorization: 'bootstrap',
    },
  },
});

3. Bootstrap from a file

const client = initialize({
  appName: 'my-application',
  url: 'https://app.unleash-hosted.com/demo/api/',
  customHeaders: { Authorization: '<YOUR_API_TOKEN>' },
  bootstrap: {
    filePath: '/tmp/some-bootstrap.json',
  },
});

Toggle definitions

Sometimes you might be interested in the raw feature toggle definitions.

import {
  initialize,
  getFeatureToggleDefinition,
  getFeatureToggleDefinitions,
} from 'unleash-client';

initialize({
  url: 'http://unleash.herokuapp.com/api/',
  customHeaders: { Authorization: '<YOUR_API_TOKEN>' },
  appName: 'my-app-name',
  instanceId: 'my-unique-instance-id',
});

const featureToggleX = getFeatureToggleDefinition('app.ToggleX');
const featureToggles = getFeatureToggleDefinitions();

Custom store provider

(Available from v3.11.x)

By default, this SDK will use a store provider that writes a backup of the feature toggle configuration to a file on disk. This happens every time it receives updated configuration from the Unleash API. You can swap out the store provider with either the provided in-memory store provider or a custom store provider implemented by you.

1. Use InMemStorageProvider

import { initialize, InMemStorageProvider } from 'unleash-client';

const client = initialize({
  appName: 'my-application',
  url: 'http://localhost:3000/api/',
  customHeaders: { Authorization: '<YOUR_API_TOKEN>' },
  storageProvider: new InMemStorageProvider(),
});

2. Custom store provider backed by Redis

import { initialize, InMemStorageProvider } from 'unleash-client';

import { createClient } from 'redis';

class CustomRedisStore {
  async set(key, data) {
    const client = createClient();
    await client.connect();
    await client.set(key, JSON.stringify(data));
  }
  async get(key) {
    const client = createClient();
    await client.connect();
    const data = await client.get(key);
    return JSON.parse(data);
  }
}

const client = initialize({
  appName: 'my-application',
  url: 'http://localhost:3000/api/',
  customHeaders: {
    Authorization: 'my-key',
  },
  storageProvider: new CustomRedisStore(),
});

Custom repository

You can manage the underlying data layer yourself if you want to. This enables you to use Unleash offline, from a browser environment, or by implement your own caching layer. See example.

Unleash depends on a ready event of the repository you pass in. Be sure that you emit the event after you've initialized Unleash.

Usage with HTTP and HTTPS proxies

You can connect to the Unleash API through the corporate proxy by setting one of the environment variables: HTTP_PROXY or HTTPS_PROXY.

Design philosophy

This feature flag SDK is designed according to our design philosophy. You can read more about that here.

changelog

Changelog


⚠️ No longer in use. See GitHub Releases.


3.19.1

  • fix: always resolve startUnleash promise (#442)

3.19.0

  • fix: use base node12 tsconfig (#427)
  • chore: use builtin caching of actions/setup-node (#429)
  • chore: run CI on node versions 18 and 19 (#428)
  • docs: mention that environment is not environment (#431)
  • chore(deps): update dependency prettier to v2.8.4 (#425)
  • chore(deps): update dependency typescript to v4.9.5 (#422)
  • chore(deps): update dependency eslint to v8.34.0 (#421)
  • chore(deps): update dependency @types/node to v18.14.1 (#424)

3.18.1

  • fix: add testcase for config-hash
  • chore(deps): bump http-cache-semantics from 4.1.0 to 4.1.1 (#423)
  • fix: cyclic dependencies
  • fix: only produce hash of primitive values
  • chore(deps): update dependency @typescript-eslint/eslint-plugin to v5.51.0 (#419)

3.18.0

  • feat: gracefully handle unsuccessful metrics post (#414)
  • feat/flush metrics (#415)
  • feat: add metrics jitter support (#412)
  • fix: Allow SDK to startup when backup data is corrupt (#418)
  • fix: flexible-rollout random stickiness is not random enough (#417)
  • fix: build correct version on npm version
  • chore(deps): update dependency eslint-plugin-import to v2.27.5 (#416)
  • chore(deps): update dependency @typescript-eslint/eslint-plugin to v5.48.2 (#413)
  • chore(deps): update dependency eslint to v8.32.0 (#410)
  • chore(deps): update dependency prettier to v2.8.3 (#406)
  • chore(deps): update dependency eslint-plugin-import to v2.27.4 (#404)

3.17.0

  • feat: Only initialize the SDK once. (#368)
  • fix: upgrade semver to 7.3.8
  • fix: add resolution for debug
  • fix: add resolution for minimatch
  • fix: add resolution for qs
  • fix: add resolution for json5
  • fix: update yarn.lock
  • docs: Update the readme with info from docs.getunleash (#399)
  • docs: minor fix in README
  • chore(deps): update dependency debug to v4 (#402)
  • chore(deps): update dependency json5 to v2 (#401)
  • chore(deps): update dependency eslint to v8.31.0 (#394)
  • chore(deps): update dependency nock to v13.3.0 (#400)
  • chore(deps): update dependency @typescript-eslint/eslint-plugin to v5.48.1 (#395)
  • chore(deps): update dependency eslint-config-prettier to v8.6.0 (#396)
  • chore(deps): update dependency prettier to v2.8.2 (#398)
  • chore(deps): update dependency @typescript-eslint/eslint-plugin to v5.47.1 (#346)
  • chore(deps): update dependency typescript to v4.9.4 (#386)
  • chore(deps): update dependency sinon to v15 (#391)
  • chore(deps): update dependency @types/node to v18 (#380)
  • chore(deps): update dependency @types/node to v14.18.36 (#382)
  • chore(deps): update dependency eslint to v8.30.0 (#367)
  • chore(deps): update dependency prettier to v2.8.1 (#387)

3.16.1

  • fix: handle socket hang up gracefully. (#392)
  • chore(deps): update dependency @types/semver to v7.3.13 (#383)
  • chore(deps): update dependency lint-staged to v12.5.0 (#369)
  • chore(deps): update dependency @types/node to v14.18.32 (#365)
  • chore: Update build-details

3.16.0

  • fix: Emit "unchanged" event (#376)
  • chore(deps): update dependency @types/murmurhash3js to v3.0.3 (#373)
  • Add project to payload (#364)
  • chore(deps): update dependency eslint to v8.23.0 (#363)
  • chore(deps): update dependency typescript to v4.8.2 (#362)
  • chore(deps): update dependency @types/semver to v7.3.12 (#361)
  • chore(deps): update dependency eslint to v8.22.0 (#356)
  • chore(deps): update dependency @types/make-fetch-happen to v10 (#357)
  • chore(deps): update dependency @unleash/client-specification to v4.2.2 (#355)
  • chore(deps): update dependency @types/node to v14.18.26 (#354)
  • meta: add stale bot config (reference unleash/.github) (#352)
  • chore: Update build-details

3.15.0

  • feat: add impression events (#336)
  • fix: string operator needs to guard against non-string values (#343)
  • fix(deps): update dependency make-fetch-happen to v10 (#300)
  • fix: NOT_IN operator for missing contextField should return true. (#340)
  • fix: Use fallback value if not initialised (#339)
  • chore(deps): update dependency @types/node to v14.18.21 (#341)
  • chore(deps): update dependency @typescript-eslint/eslint-plugin to v5.29.0 (#294)
  • chore(deps): update dependency eslint-plugin-import to v2.26.0 (#322)
  • chore(deps): update dependency @types/semver to v7.3.10 (#342)
  • chore(deps): update dependency eslint to v8.18.0 (#298)
  • chore(deps): update dependency prettier to v2.7.1 (#323)
  • chore(deps): update dependency typescript to v4.7.4 (#324)
  • chore(deps): update actions/checkout action to v3 (#325)
  • chore(deps): update actions/setup-node action to v3 (#326)

3.14.1

  • feat: pass spec header so global segments can be toggled (#335)
  • chore: Update build-details
  • chore: Update build-details

3.14.0

  • feat: Added agent to the HttpOptions (#332)
  • feat: Add support for handling global segments (#329)
  • fix: force semver operators to resolve to false against non strict semver (#333)
  • fix: Type is missing from FeatureInterface used by getFeatureDefinitions and more (#328)
  • docs: fix example usage in readme (#330)
  • meta: add external PRs to project board
  • meta: add 'new items to project board' workflow
  • chore: upgrade unleash client spec to 4.2.0
  • chore: Update build-details

3.13.4

  • fix: Cannot read property 'split' of undefined in UserWithIdStrategy (#311)
  • fix: Use string[] instead of String[] for Override values (#320)
  • docs: Add remaining change requests from #318 (#319)
  • docs: Clearer client alternative usage and highlight the require use of error handling (#318)
  • chore(deps): update dependency @types/node to v14.18.16 (#321)
  • chore(deps): update dependency sinon to v13 (#299)
  • chore(deps): update dependency lint-staged to v12.4.1 (#295)
  • chore(deps): update dependency nock to v13.2.4 (#301)
  • chore(deps): update dependency @types/make-fetch-happen to v9.0.2 (#312)
  • chore(deps): update dependency eslint-config-prettier to v8.5.0 (#317)
  • chore(deps): pin dependencies (#306)
  • chore(deps): update dependency redis to v4.0.6 (#314)
  • chore: correct changelog
  • chore: Update build-details

    3.13.3

  • fix: getVariant should also count usage

3.13.2

  • fix: remove unused dependency nodemon (#315)

3.12.0

  • feat: add support for new constraint operators (#289)

    3.11.3

  • fix: should handle empty backups (#303)

    3.11.2

  • fix: ready should not be emitted if local backup is empty

    3.11.1

  • fix: add impression data property to feature configuration (#293)

    3.11.0

  • feat: add bootstrap capability (#283)

  • fix: Update prs.yaml (#248)
  • fix: require json-schema 0.4.0 or higher
  • fix: remove package-lock.json (we are using yarn.lock)
  • chore(deps): update dependency lint-staged to v12.3.1 (#281)
  • build(deps): bump trim-off-newlines from 1.0.1 to 1.0.3 (#291)
  • chore(deps): update dependency @types/node to v14.18.9
  • chore(deps): update dependency eslint to v8.7.0
  • chore(deps): update dependency @typescript-eslint/eslint-plugin to v5.10.0 (#277)
  • chore(deps): update dependency eslint-plugin-import to v2.25.4 (#285)
  • chore(deps): update dependency nock to v13.2.2 (#287)
  • chore(deps): update dependency typescript to v4.5.5 (#288)
  • chore(deps): pin dependency redis to 4.0.2 (#290)
  • chore(workflows): update with new branch names (#280)
  • chore(deps): update dependency eslint to v8.5.0 (#275)
  • chore(deps): update dependency lint-staged to v12.1.3 (#276)
  • chore(deps): update dependency @types/node to v14.18.2 (#278)
  • chore(deps): update dependency @types/node to v14.18.1 (#274)
  • chore(deps): update dependency eslint to v8 (#267)
  • chore(deps): update dependency @typescript-eslint/eslint-plugin to v5 (#266)
  • chore(deps): update dependency eslint-config-airbnb-base to v15 (#268)
  • chore(deps): update dependency eslint-plugin-prettier to v4 (#270)
  • chore(deps): update dependency @typescript-eslint/eslint-plugin to v4.33.0 (#259)
  • chore(deps): update dependency typescript to v4.5.4 (#273)
  • chore(deps): update dependency typescript to v4.5.3 (#255)
  • chore(deps): update dependency lint-staged to v12 (#271)
  • chore(deps): update metcalfc/changelog-generator action to v3 (#272)
  • chore(deps): update dependency @types/node to v14.18.0 (#258)
  • chore(deps): update dependency eslint-plugin-import to v2.25.3 (#260)
  • chore(deps): update dependency lint-staged to v11.2.6 (#261)
  • chore(deps): update actions/setup-node action to v2 (#263)
  • chore(deps): update dependency prettier to v2.5.1 (#262)
  • chore(deps): update c-hive/gha-yarn-cache action to v2 (#264)
  • chore(deps): update dependency husky to v7.0.4 (#257)
  • chore(deps): update dependency eslint-plugin-prettier to v3.4.1 (#256)
  • chore(deps): update dependency nock to v13.2.1 (#253)
  • chore(deps): update dependency sinon to v12 (#254)
  • chore(deps): update dependency @types/make-fetch-happen to v9.0.1 (#250)
  • chore(deps): pin dependencies (#249)
  • chore(deps): add renovate.json (#242)

3.10.1

  • fix: expose TagFilter enum

3.10.0

  • feat: Add support to provide namePrefix and tags for filtering (#237)
  • fix: cleanup tag interface
  • fix: Changed the priority of the strategy block (#235)
  • fix: bump eslint-config-prettier to 8.3.0
  • fix: upgrade sinon to 11.1.2
  • fix: run tests all node.js > 12
  • fix: upgrade husky to 7.0.1
  • fix: bump lint staged to 11.1.2
  • fix: bump @types/node to 14.17.9
  • fix: upgrade @ava/babel to 2.0.0
  • fix: failing test
  • fix: update yarn.lock
  • fix: bump make-fetch-happen to version 9.0.4

3.9.0

  • fix: add support for passing in rejectUnauthorized to http fetch (#229)

3.8.1

  • Fix: (types) relax argument requirements (#223)

3.8.0

  • feat: use make-fetch-happen instead of node-fetch (#217)

3.7.1

  • fix: Handle trailing slash or not in base url (#214)

3.7.0

  • feat: variant stickiness (#202)
  • feat: add "synchronized" event (#212)
  • feat: add query support (#211)

3.6.0

  • feat: flexible rollout - custom stickiness (#201)
  • fix: add another test-script
  • fix: add test for variants validation
  • fix: Keep fetching if customHeadersFunction fails. (#210)
  • fix: emit warn if initialize is called multiple times
  • fix tests for node 10
  • fix: add meta to test-script

3.5.0

  • fix: Replace deprecated request library with node-fetch
  • chore: upgrade typescript to 4.1.3
  • chore: upgrade sinon to 9.2.4
  • chore: upgrade eslint to 7.19.0
  • chore: migrate to eslint-config-airbnb
  • chore: upgrade nock to 13.0.7
  • chore: upgrade ava to 3.15.0
  • chore: adopt eslint-config-airbnb-typescript

3.4.0

  • fix: Only unref timers when used in node, where unref is defined (#188)
  • feat: Expose Context and Variant interfaces (#190)
  • fix: Typo in Properties interface name (#189)
  • feat: Add stale property to the FeatureInterface (#185)
  • chore: correct example in README.
  • chore: Update build-details

3.3.6

  • fix: upgrade request to version 2.88.2
  • fix: add keepAlive options to request.

3.3.5

  • Fix typo (#174)
  • fix: varant should support all context fields (#178)
  • Update @types/node to the latest version 🚀 (#175)
  • Merge pull request #176 from aBMania/patch-1
  • fix typo in readme
  • fix: license year and company

3.3.4

  • chore: upgrade typscrip to version 3.8.2
  • chore: Update nock to the latest version
  • chore: Update sinon to the latest version
  • chore(package): update lint-staged to version 10.0.3

3.3.3

  • fix: clean up properties types a bit

3.3.2

  • feat: add events for changed and unchanged repository
  • fix: upgrade @types/node to verison 12.12.25
  • fix: upgrade typescript to version 3.7.5
  • fix: upgrade husky to version 4.2.1
  • fix: upgrade sinon to version 8.1.1
  • fix: upgrade prettier to verseion 1.19.1
  • fix: upgrade nock to version 11.7.2
  • fix: upgrade dependencies
  • fix: remove package-lock.json
  • fix: upgrade sinon to version 8.1.1
  • fix: upgrade prettier to verseion 1.19.1
  • fix: upgrade nock to version 11.7.2
  • fix: upgrade dependencies
  • fix: remove package-lock.json

3.3.1

  • fix: ensure destroy works more consistently (#153)

3.3.0

  • feat: Add support for fallback function (#150)
  • feat: customHeaderFunction to dynamic setting headers (#152)
  • fix: upgrade @unleash/client-specification to version 3.3.0

3.2.9

  • fix: clean up strategy tests
  • fix: Missing context field should not crash constraints.
  • fix: bump eslint-utils from 1.3.1 to 1.4.2 (#147)
  • fix: Update cross-env to the latest version 🚀 (#145)

3.2.8

  • fix: script for updating client version

3.2.7

  • fix: upgrade ava to version 2.2.0
  • fix: upgrade husky to version 3.0.1
  • fix: upgrade eslint to version 6.1.0
  • fix: upgrade lint-staged to version 9.2.1
  • feat: Add support for static context fields (#136)
  • feat: add support for strategy constraint (beta)
  • feat: add support for flexible-rollout-strategy

3.2.6

  • fix: update README init param defaults to milliseconds (#126)
  • fix: bump js-yaml from 3.12.0 to 3.13.1 (#129)
  • fix: Strategy gradualRolloutRandom random should <= 100 (#132)
  • chore: Update readme - appName is required (#130)
  • chore: control gradual rollout strategy randomness (#133)

3.2.5

  • feature: Allow user to implement custom toggle repository
  • feat: Drop node 6 support (EOL)
  • feat: Get all feature toggle definitions at once
  • fix: Update lint-staged to the latest version 8.1.7
  • fix: Update nock to version 10.0.6
  • fix: Update @types/node to version 12.0.2
  • fix: Update husky to version 2.3.0
  • fix: Update ava to version 1.4.1
  • fix: Update eslint to version 5.16.0
  • fix: Update nyc to version 14.1.1

3.2.4

  • feat: add timeout option for http requests (#115)
  • fix: Upgrade husky to version 2.2.0
  • fix: Update lint-staged to the latest version 🚀 (#112)
  • fix: Update @types/node to the latest version 🚀 (#113)
  • fix: Update @types/nock to the latest version 🚀 (#111)
  • chore: update deails.json

3.2.3

  • fix: details.json should be updated after npm version

3.2.2

  • fix: remove pkginfo dependency.

3.2.1

  • fix: typo in variant metrics making them not show up

3.2.0

  • feat: Add support for toggle variants

3.1.2

  • fix(GradualRolloutStrategy): percentage=0 should mean disabled

3.1.1

  • Updated request.js to version 2.88.0

3.1.0

  • Add method to get the featureToggle definition
  • Expose count method to extensions in unleash client

3.0.0

2.3.1

2.3.0

  • Add support for custom headers

2.2.1

  • Fix broken metrics reporting

2.2.0

  • Add user-agent header to requests
  • Add appName and instanceId as headers to post requests

2.1.3

  • Bugfix: Must export Strategy interface to allow custom implementations.

2.1.2

  • Unleash should not throw if os.userInfo throws #35

2.1.1 (March 2017)

  • allow appName to contain "/" when storing file backup

2.1.0 (February 2017)

  • Provide implementations of pre-defined activation strategies.
    • applicationHostname
    • gradualRolloutRandom
    • gradualRolloutSessionId
    • gradualRolloutUserId
    • remoteAddress
    • userWithId

1.0.0 (January 2017)

  • Support multiple strategies. This makes it easy to use multiple activation strategies in combination.
  • Client metrics. Gives details about what toggles a specific client application uses, how many times a toggle was evaluated to true / false.
  • Client registration.

0.0.1 (January 2015)

  • Initial public release