0.7.1 • Published 16 days ago

@openfeature/flagd-web-provider v0.7.1

Weekly downloads
-
License
-
Repository
-
Last release
16 days ago

flagd-web Provider for OpenFeature

Experimental

A feature flag daemon with a Unix philosophy.

Installation

:warning: This provider requires the use of the experimental @openfeature/web-sdk:

npm install @openfeature/web-sdk
npm install @openfeature/flagd-web-provider

Usage

The FlagdWebProvider communicates with flagd via the connect protocol.

Available options

Option nameTypeDefaultDescription
hoststringsets the host used to connect to the flagd instance
pathPrefixstring""sets the path at which the flagd gRPC service is available, for example: /api/flagd (optional)
portnumber443sets the port used to connect to the flagd instance
tlsbooleantruewhen 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. A negative value means no retries.
maxDelaynumber60000sets the maximum time in ms to wait between reconnect intervals

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 receives events from flagd with changes. Combined with the event API in the web SDK, this allows for subscription to flag value changes in clients.

client.addHandler(ProviderEvents.Ready, () => {
  // do something when the configuration has changed.
});

Caching

The FlagdWebProvider evaluates flags in bulk, taking into account the evaluation context, and then caches them in memory for local evaluation. The cache is invalidated when flag configuration change events are received.

Example

OpenFeature.setProvider(
  new FlagdWebProvider({
    host: 'myapp.com',
    port: 443,
    tls: true,
    maxRetries: 10,
    maxDelay: 30000,
  })
);

Building

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

NOTE: Buf must be installed to build locally.

Running unit tests

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

0.7.1

16 days ago

0.7.0

24 days ago

0.6.0

2 months ago

0.5.1

3 months ago

0.5.0

3 months ago

0.4.1

5 months ago

0.3.5

10 months ago

0.4.0

10 months ago

0.3.0

1 year ago

0.2.0

1 year ago

0.3.2

1 year ago

0.3.1

1 year ago

0.3.4

1 year ago

0.3.3

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago