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

@openfeature/server-sdk

Package Overview
Dependencies
Maintainers
2
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@openfeature/server-sdk - npm Package Compare versions

Comparing version 1.7.0 to 1.7.1

6

package.json
{
"name": "@openfeature/server-sdk",
"version": "1.7.0",
"version": "1.7.1",
"description": "OpenFeature SDK for JavaScript",

@@ -51,7 +51,7 @@ "main": "./dist/cjs/index.js",

"peerDependencies": {
"@openfeature/core": "0.0.16"
"@openfeature/core": "0.0.17"
},
"devDependencies": {
"@openfeature/core": "0.0.16"
"@openfeature/core": "0.0.17"
}
}

@@ -15,8 +15,8 @@ <!-- markdownlint-disable MD033 -->

<p align="center" class="github-badges">
<a href="https://github.com/open-feature/spec/tree/v0.7.0">
<a href="https://github.com/open-feature/spec/releases/tag/v0.7.0">
<img alt="Specification" src="https://img.shields.io/static/v1?label=specification&message=v0.7.0&color=yellow&style=for-the-badge" />
</a>
<!-- x-release-please-start-version -->
<a href="https://github.com/open-feature/js-sdk/releases/tag/server-sdk-v1.7.0">
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v1.7.0&color=blue&style=for-the-badge" />
<a href="https://github.com/open-feature/js-sdk/releases/tag/server-sdk-v1.7.1">
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v1.7.1&color=blue&style=for-the-badge" />
</a>

@@ -40,3 +40,3 @@ <!-- x-release-please-end -->

[OpenFeature](https://openfeature.dev) is an open standard that provides a vendor-agnostic, community-driven API for feature flagging that works with your favorite feature flag management tool.
[OpenFeature](https://openfeature.dev) is an open specification that provides a vendor-agnostic, community-driven API for feature flagging that works with your favorite feature flag management tool.

@@ -62,3 +62,4 @@ <!-- x-hide-in-docs-end -->

```sh
yarn add @openfeature/server-sdk
# yarn requires manual installation of the @openfeature/core peer-dependency
yarn add @openfeature/server-sdk @openfeature/core
```

@@ -72,3 +73,3 @@

// Register your feature flag provider
OpenFeature.setProvider(new YourProviderOfChoice());
await OpenFeature.setProviderAndWait(new YourProviderOfChoice());

@@ -113,6 +114,20 @@ // create a new client

#### Awaitable
To register a provider and ensure it is ready before further actions are taken, you can use the `setProviderAndWait` method as shown below:
```ts
OpenFeature.setProvider(new MyProvider())
await OpenFeature.setProviderAndWait(new MyProvider());
```
#### Synchronous
To register a provider in a synchronous manner, you can use the `setProvider` method as shown below:
```ts
OpenFeature.setProvider(new MyProvider());
```
Once the provider has been registered, the status can be tracked using [events](#eventing).
In some situations, it may be beneficial to register multiple providers in the same application.

@@ -218,2 +233,5 @@ This is possible using [named clients](#named-clients), which is covered in more details below.

Named providers can be set in an awaitable or synchronous way.
For more details, please refer to the [providers](#providers) section.
### Eventing

@@ -232,3 +250,3 @@

OpenFeature.addHandler(ProviderEvents.Ready, (eventDetails) => {
console.log(`Ready event from: ${eventDetails?.clientName}:`, eventDetails);
console.log(`Ready event from: ${eventDetails?.providerName}:`, eventDetails);
});

@@ -239,3 +257,3 @@

client.addHandler(ProviderEvents.Error, (eventDetails) => {
console.log(`Error event from: ${eventDetails?.clientName}:`, eventDetails);
console.log(`Error event from: ${eventDetails?.providerName}:`, eventDetails);
});

@@ -268,2 +286,4 @@ ```

class MyProvider implements Provider {
// Adds runtime validation that the provider is used with the expected SDK
public readonly runsOn = 'server';

@@ -270,0 +290,0 @@ readonly metadata = {

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