New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@openfeature/flagd-web-provider

Package Overview
Dependencies
Maintainers
2
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@openfeature/flagd-web-provider

![Experimental](https://img.shields.io/badge/experimental-breaking%20changes%20allowed-yellow)

  • 0.1.4
  • npm
  • Socket score

Version published
Weekly downloads
23
decreased by-98.06%
Maintainers
2
Weekly downloads
 
Created
Source

flagd-web Provider for OpenFeature

Experimental

A feature flag daemon with a Unix philosophy.

Installation

:warning: This provider requires an experimental version of the JS-SDK:

npm i @openfeature/js-sdk@1.0.99-experimental-55bf085fbdec8a76753b02b3efee8bec3eac53c0
npm install @openfeature/flagd-web-provider

Usage

The FlagdWebProvider communicates with flagd via the connect protocol.

Reconnection

If the connection to the flagd instance fails, the provider will attempt to reconnect with an exponential back-off. The maxDelay and maxRetries can be specified to customize reconnect behavior.

Event streaming

The FlagdWebProvider can be configured to receive events for flag changes. Combined with the event API in the JS SDK, this allows for subscription to flag value changes in clients.

Caching

The FlagdWebProvider will cache resolve flag values based on the associated flag-key and context. Values are cached in localstorage. A TTL for cached values can be specified. If event-streaming is enabled, the cache will be invalidated intelligently when flag configuration change events are received.

Available options

Option nameTypeDefaultDescription
hoststringlocalhostsets the host used to connect to the flagd instance
portnumber8013sets the port used to connect to the flagd instance
tlsbooleanfalsewhen set to true the provider will attempt to connect to flagd via https
maxRetriesnumber0sets the maximum number of retries for a connection to be made to the flagd instance, a value of 0 means unlimited
maxDelaynumber60000sets the maximum time in ms to wait between reconnect intervals
cachingbooleantruewhen set to true the provider will use client side caching
cacheTtlnumber300sets the timeout in ms for items in the cache, a value of 0 disables the ttl
eventStreamingbooleantrueenables or disables streaming and event features.

Example

OpenFeature.setProvider(
  new FlagdWebProvider({
    host: 'localhost',
    port: 8013,
    tls: true,
    maxRetries: 10,
    maxDelay: 30000,
    cache: true,
    cacheTTL: 60000,
  })
);

Building

Run npx nx package providers-flagd-web to build the library.

NOTE: Buf must be installed to build locally.

Running unit tests

Run npx nx test providers-flagd-web to execute the unit tests via Jest.

FAQs

Package last updated on 19 Jan 2023

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