Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@spotify-confidence/openfeature-server-provider

Package Overview
Dependencies
Maintainers
4
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@spotify-confidence/openfeature-server-provider

  • 0.2.9
  • npm
  • Socket score

Version published
Weekly downloads
4
decreased by-82.61%
Maintainers
4
Weekly downloads
 
Created
Source

OpenFeature JS SDK JavaScript Confidence Provider

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.

FAQs

Package last updated on 07 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc