0.2.3 • Published 18 days ago

@spotify-confidence/openfeature-server-provider v0.2.3

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
18 days ago

OpenFeature JS SDK JavaScript Confidence Provider

npm.io

JavaScript implementation of the Confidence OpenFeature web provider, to be used in conjunction wth the OpenFeature JS SDK. This implements the dynamic paradigm of OpenFeature.

Usage

Adding the dependencies

To add the packages to your dependencies run:

yarn add @openfeature/server-sdk @spotify-confidence/openfeature-server-provider @openfeature/core

Enabling the provider, setting the evaluation context and resolving flags

import { createConfidenceServerProvider } from '@spotify-confidence/openfeature-server-provider';
import { OpenFeature } from '@openfeature/server-sdk';

const provider = createConfidenceServerProvider({
  clientSecret: 'your-client-secret',
  fetchImplementation: fetch,
  timeout: 1000,
});

OpenFeature.setProvider(provider);

const client = OpenFeature.getClient();

client
  .getBooleanValue('flagName.bool', false, {
    targetingKey: `your targeting key`,
  })
  .then(result => {
    console.log('result:', result);
  });

Region

The region option is used to set the region for the network request to the Confidence backend. When the region is not set, the default (global) region will be used. The current regions are: eu and us, the region can be set as follows:

const provider = createConfidenceServerProvider({
  region: 'eu', // or 'us'
  // ... other options
});

Timeout

The timeout option is used to set the timeout for the network request to the Confidence backend. When the timeout is reached, default values will be returned.

Configuring Apply

See apply concept.

Backend apply is the only supported method in the ConfidenceServerProvider.

0.2.3

18 days ago

0.2.2-rc.0

19 days ago

0.2.1-rc.0

26 days ago

0.2.0-rc.0

2 months ago

0.1.5

4 months ago

0.1.4

4 months ago

0.1.3

4 months ago

0.1.2

6 months ago

0.1.1

6 months ago

0.1.0

6 months ago

0.0.5

7 months ago

0.0.4

7 months ago

0.0.3

9 months ago

0.0.2

9 months ago

0.0.1

10 months ago