@openfeature/server-sdk 1.6.2 → 1.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -14
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -16,16 +16,16 @@
|
|
|
16
16
|
<img alt="Specification" src="https://img.shields.io/static/v1?label=specification&message=v0.7.0&color=yellow&style=for-the-badge" />
|
|
17
17
|
</a>
|
|
18
18
|
<!-- x-release-please-start-version -->
|
|
19
|
-
<a href="https://github.com/open-feature/js-sdk/releases/tag/
|
|
20
|
-
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v1.6.
|
|
19
|
+
<a href="https://github.com/open-feature/js-sdk/releases/tag/server-sdk-v1.6.3">
|
|
20
|
+
<img alt="Release" src="https://img.shields.io/static/v1?label=release&message=v1.6.3&color=blue&style=for-the-badge" />
|
|
21
21
|
</a>
|
|
22
22
|
<!-- x-release-please-end -->
|
|
23
23
|
<br/>
|
|
24
24
|
<a href="https://open-feature.github.io/js-sdk/modules/OpenFeature_JS_SDK.html">
|
|
25
25
|
<img alt="API Reference" src="https://img.shields.io/badge/reference-teal?logo=javascript&logoColor=white" />
|
|
26
26
|
</a>
|
|
27
|
-
<a href="https://www.npmjs.com/package/@openfeature/
|
|
28
|
-
<img alt="NPM Download" src="https://img.shields.io/npm/dm/%40openfeature%
|
|
27
|
+
<a href="https://www.npmjs.com/package/@openfeature/server-sdk">
|
|
28
|
+
<img alt="NPM Download" src="https://img.shields.io/npm/dm/%40openfeature%2Fserver-sdk" />
|
|
29
29
|
</a>
|
|
30
30
|
<a href="https://codecov.io/gh/open-feature/js-sdk">
|
|
31
31
|
<img alt="codecov" src="https://codecov.io/gh/open-feature/js-sdk/branch/main/graph/badge.svg?token=3DC5XOEHMY" />
|
|
@@ -51,19 +51,19 @@
|
|
|
51
51
|
#### npm
|
|
52
52
|
|
|
53
53
|
```sh
|
|
54
|
-
npm install --save @openfeature/
|
|
54
|
+
npm install --save @openfeature/server-sdk
|
|
55
55
|
```
|
|
56
56
|
|
|
57
57
|
#### yarn
|
|
58
58
|
|
|
59
59
|
```sh
|
|
60
|
-
yarn add @openfeature/
|
|
60
|
+
yarn add @openfeature/server-sdk
|
|
61
61
|
```
|
|
62
62
|
|
|
63
63
|
### Usage
|
|
64
64
|
|
|
65
65
|
```ts
|
|
66
|
-
import { OpenFeature } from '@openfeature/
|
|
66
|
+
import { OpenFeature } from '@openfeature/server-sdk';
|
|
67
67
|
|
|
68
68
|
// Register your feature flag provider
|
|
69
69
|
OpenFeature.setProvider(new YourProviderOfChoice());
|
|
@@ -146,7 +146,7 @@ If the hook you're looking for hasn't been created yet, see the [develop a hook]
|
|
|
146
146
|
Once you've added a hook as a dependency, it can be registered at the global, client, or flag invocation level.
|
|
147
147
|
|
|
148
148
|
```ts
|
|
149
|
-
import { OpenFeature } from "@openfeature/
|
|
149
|
+
import { OpenFeature } from "@openfeature/server-sdk";
|
|
150
150
|
|
|
151
151
|
// add a hook globally, to run on all evaluations
|
|
152
152
|
OpenFeature.addHooks(new ExampleGlobalHook());
|
|
@@ -166,7 +166,7 @@ This behavior can be overridden by passing a custom logger either globally or pe
|
|
|
166
166
|
A custom logger must implement the [Logger interface](../shared/src/logger/logger.ts).
|
|
167
167
|
|
|
168
168
|
```ts
|
|
169
|
-
import type { Logger } from "@openfeature/
|
|
169
|
+
import type { Logger } from "@openfeature/server-sdk";
|
|
170
170
|
|
|
171
171
|
// The logger can be anything that conforms with the Logger interface
|
|
172
172
|
const logger: Logger = console;
|
|
@@ -186,7 +186,7 @@ A name is a logical identifier which can be used to associate clients with a par
|
|
|
186
186
|
If a name has no associated provider, the global provider is used.
|
|
187
187
|
|
|
188
188
|
```ts
|
|
189
|
-
import { OpenFeature, InMemoryProvider } from "@openfeature/
|
|
189
|
+
import { OpenFeature, InMemoryProvider } from "@openfeature/server-sdk";
|
|
190
190
|
|
|
191
191
|
const myFlags = {
|
|
192
192
|
'v2_enabled': {
|
|
@@ -219,7 +219,7 @@ Some providers support additional events, such as `PROVIDER_CONFIGURATION_CHANGE
|
|
|
219
219
|
Please refer to the documentation of the provider you're using to see what events are supported.
|
|
220
220
|
|
|
221
221
|
```ts
|
|
222
|
-
import { OpenFeature, ProviderEvents } from '@openfeature/
|
|
222
|
+
import { OpenFeature, ProviderEvents } from '@openfeature/server-sdk';
|
|
223
223
|
|
|
224
224
|
// OpenFeature API
|
|
225
225
|
OpenFeature.addHandler(ProviderEvents.Ready, (eventDetails) => {
|
|
@@ -239,7 +239,7 @@ The OpenFeature API provides a close function to perform a cleanup of all regist
|
|
|
239
239
|
This should only be called when your application is in the process of shutting down.
|
|
240
240
|
|
|
241
241
|
```ts
|
|
242
|
-
import { OpenFeature } from '@openfeature/
|
|
242
|
+
import { OpenFeature } from '@openfeature/server-sdk';
|
|
243
243
|
|
|
244
244
|
await OpenFeature.close()
|
|
245
245
|
```
|
|
@@ -253,7 +253,7 @@ This can be a new repository or included in [the existing contrib repository](ht
|
|
|
253
253
|
You’ll then need to write the provider by implementing the [Provider interface](./src/provider/provider.ts) exported by the OpenFeature SDK.
|
|
254
254
|
|
|
255
255
|
```ts
|
|
256
|
-
import { JsonValue, Provider, ResolutionDetails } from '@openfeature/
|
|
256
|
+
import { JsonValue, Provider, ResolutionDetails } from '@openfeature/server-sdk';
|
|
257
257
|
|
|
258
258
|
// implement the provider interface
|
|
259
259
|
class MyProvider implements Provider {
|
|
@@ -303,7 +303,7 @@ This can be a new repository or included in [the existing contrib repository](ht
|
|
|
303
303
|
Implement your own hook by conforming to the [Hook interface](../shared/src/hooks/hook.ts).
|
|
304
304
|
|
|
305
305
|
```ts
|
|
306
|
-
import type { Hook, HookContext, EvaluationDetails, FlagValue } from "@openfeature/
|
|
306
|
+
import type { Hook, HookContext, EvaluationDetails, FlagValue } from "@openfeature/server-sdk";
|
|
307
307
|
|
|
308
308
|
export class MyHook implements Hook {
|
|
309
309
|
after(hookContext: HookContext, evaluationDetails: EvaluationDetails<FlagValue>) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfeature/server-sdk",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.3",
|
|
4
4
|
"description": "OpenFeature SDK for JavaScript",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"files": [
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@openfeature/shared": "*"
|
|
52
52
|
},
|
|
53
53
|
"typedoc": {
|
|
54
|
-
"displayName": "OpenFeature
|
|
54
|
+
"displayName": "OpenFeature Server SDK",
|
|
55
55
|
"entryPoint": "./src/index.ts"
|
|
56
56
|
}
|
|
57
57
|
}
|