@openfeature/flagd-provider 0.8.1 → 0.8.2
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 +21 -15
- package/index.cjs +1 -0
- package/index.js +1 -0
- package/package.json +1 -1
- /package/src/lib/service/grpc/{service.d.ts → grpc-service.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Server-
|
|
1
|
+
# Server-Side flagd Provider
|
|
2
2
|
|
|
3
3
|
Flagd is a simple daemon for evaluating feature flags.
|
|
4
4
|
It is designed to conform to OpenFeature schema for flag definitions.
|
|
@@ -21,19 +21,19 @@ $ npm install @openfeature/js-sdk
|
|
|
21
21
|
The `FlagdProvider` supports multiple configuration options that determine now the SDK communicates with flagd.
|
|
22
22
|
Options can be defined in the constructor or as environment variables, with constructor options having the highest precedence.
|
|
23
23
|
|
|
24
|
-
### Available
|
|
24
|
+
### Available Options
|
|
25
25
|
|
|
26
|
-
| Option name | Environment variable name
|
|
27
|
-
| --------------------- |
|
|
28
|
-
| host | FLAGD_HOST
|
|
29
|
-
| port | FLAGD_PORT
|
|
30
|
-
| tls | FLAGD_TLS
|
|
31
|
-
| socketPath | FLAGD_SOCKET_PATH
|
|
32
|
-
| cache | FLAGD_CACHE
|
|
33
|
-
| maxCacheSize | FLAGD_MAX_CACHE_SIZE
|
|
34
|
-
| maxEventStreamRetries | FLAGD_MAX_EVENT_STREAM_RETRIES
|
|
26
|
+
| Option name | Environment variable name | Type | Default | Values |
|
|
27
|
+
| --------------------- | ------------------------------ | ------- | --------- | ------------ |
|
|
28
|
+
| host | FLAGD_HOST | string | localhost | |
|
|
29
|
+
| port | FLAGD_PORT | number | 8013 | |
|
|
30
|
+
| tls | FLAGD_TLS | boolean | false | |
|
|
31
|
+
| socketPath | FLAGD_SOCKET_PATH | string | - | |
|
|
32
|
+
| cache | FLAGD_CACHE | string | lru | lru,disabled |
|
|
33
|
+
| maxCacheSize | FLAGD_MAX_CACHE_SIZE | int | 1000 | |
|
|
34
|
+
| maxEventStreamRetries | FLAGD_MAX_EVENT_STREAM_RETRIES | int | 5 | |
|
|
35
35
|
|
|
36
|
-
### Example
|
|
36
|
+
### Example Using TCP
|
|
37
37
|
|
|
38
38
|
```
|
|
39
39
|
OpenFeature.setProvider(new FlagdProvider({
|
|
@@ -42,7 +42,7 @@ Options can be defined in the constructor or as environment variables, with cons
|
|
|
42
42
|
}))
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
### Example
|
|
45
|
+
### Example Using a Unix Socket
|
|
46
46
|
|
|
47
47
|
```
|
|
48
48
|
OpenFeature.setProvider(new FlagdProvider({
|
|
@@ -50,7 +50,7 @@ Options can be defined in the constructor or as environment variables, with cons
|
|
|
50
50
|
}))
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
-
### Supported
|
|
53
|
+
### Supported Events
|
|
54
54
|
|
|
55
55
|
The flagd provider emits `PROVIDER_READY`, `PROVIDER_ERROR` and `PROVIDER_CONFIGURATION_CHANGED` events.
|
|
56
56
|
|
|
@@ -62,12 +62,18 @@ The flagd provider emits `PROVIDER_READY`, `PROVIDER_ERROR` and `PROVIDER_CONFIG
|
|
|
62
62
|
|
|
63
63
|
For general information on events, see the [official documentation](https://openfeature.dev/docs/reference/concepts/events).
|
|
64
64
|
|
|
65
|
+
### Flag Metadata
|
|
66
|
+
|
|
67
|
+
| Field | Type | Value |
|
|
68
|
+
| ------- | ------ | ------------------------------------------------- |
|
|
69
|
+
| `scope` | string | "selector" set for the associated source in flagd |
|
|
70
|
+
|
|
65
71
|
## Building
|
|
66
72
|
|
|
67
73
|
Run `nx package providers-flagd` to build the library.
|
|
68
74
|
|
|
69
75
|
> NOTE: [Buf](https://docs.buf.build/installation) must be installed to build locally.
|
|
70
76
|
|
|
71
|
-
## Running
|
|
77
|
+
## Running Unit Tests
|
|
72
78
|
|
|
73
79
|
Run `nx test providers-flagd` to execute the unit tests via [Jest](https://jestjs.io).
|
package/index.cjs
CHANGED
|
@@ -6015,6 +6015,7 @@ class GRPCService {
|
|
|
6015
6015
|
value: parser.call(this, response.value),
|
|
6016
6016
|
reason: response.reason,
|
|
6017
6017
|
variant: response.variant,
|
|
6018
|
+
flagMetadata: response.metadata,
|
|
6018
6019
|
};
|
|
6019
6020
|
logger.debug(`${FlagdProvider.name}: resolved flag with key: ${resolved.value}, variant: ${response.variant}, reason: ${response.reason}`);
|
|
6020
6021
|
if (this._cacheActive && response.reason === jsSdk.StandardResolutionReasons.STATIC) {
|
package/index.js
CHANGED
|
@@ -6011,6 +6011,7 @@ class GRPCService {
|
|
|
6011
6011
|
value: parser.call(this, response.value),
|
|
6012
6012
|
reason: response.reason,
|
|
6013
6013
|
variant: response.variant,
|
|
6014
|
+
flagMetadata: response.metadata,
|
|
6014
6015
|
};
|
|
6015
6016
|
logger.debug(`${FlagdProvider.name}: resolved flag with key: ${resolved.value}, variant: ${response.variant}, reason: ${response.reason}`);
|
|
6016
6017
|
if (this._cacheActive && response.reason === StandardResolutionReasons.STATIC) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfeature/flagd-provider",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.2",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"publish-if-not-exists": "cp $NPM_CONFIG_USERCONFIG .npmrc && if [ \"$(npm show $npm_package_name@$npm_package_version version)\" = \"$(npm run current-version -s)\" ]; then echo 'already published, skipping'; else npm publish --access public; fi",
|
|
6
6
|
"current-version": "echo $npm_package_version"
|
|
File without changes
|