@openfeature/flagd-provider 0.13.1 → 0.13.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 +18 -6
- package/index.cjs.js +1836 -1742
- package/index.esm.d.ts +1 -0
- package/index.esm.js +1836 -1740
- package/package.json +11 -10
- package/src/lib/configuration.d.ts +6 -0
- package/src/lib/flagd-provider.d.ts +2 -6
- package/src/lib/service/in-process/file/file-fetch.d.ts +1 -1
- package/src/lib/service/in-process/grpc/grpc-fetch.d.ts +1 -1
- package/src/lib/service/in-process/in-process-service.d.ts +2 -6
- package/src/proto/ts/flagd/evaluation/v1/evaluation.d.ts +22 -14
- package/src/proto/ts/flagd/sync/v1/sync.d.ts +6 -6
- package/src/proto/ts/schema/v1/schema.d.ts +17 -14
- package/src/proto/ts/sync/v1/sync_service.d.ts +7 -4
- package/src/e2e/constants.d.ts +0 -4
- package/src/e2e/jest.config.d.ts +0 -11
- package/src/e2e/setup-in-process-provider.d.ts +0 -1
- package/src/e2e/setup-rpc-provider.d.ts +0 -1
package/README.md
CHANGED
|
@@ -38,6 +38,7 @@ Options can be defined in the constructor or as environment variables. Construct
|
|
|
38
38
|
| selector | FLAGD_SOURCE_SELECTOR | string | - | |
|
|
39
39
|
| cache | FLAGD_CACHE | string | lru | lru, disabled |
|
|
40
40
|
| maxCacheSize | FLAGD_MAX_CACHE_SIZE | int | 1000 | |
|
|
41
|
+
| defaultAuthority | FLAGD_DEFAULT_AUTHORITY | string | - | rpc, in-process |
|
|
41
42
|
|
|
42
43
|
#### Resolver type-specific Defaults
|
|
43
44
|
|
|
@@ -61,7 +62,7 @@ In the above example, the provider expects flagd to be available at `localhost:8
|
|
|
61
62
|
|
|
62
63
|
Alternatively, you can use socket paths to connect to flagd.
|
|
63
64
|
|
|
64
|
-
```
|
|
65
|
+
```ts
|
|
65
66
|
OpenFeature.setProvider(new FlagdProvider({
|
|
66
67
|
socketPath: "/tmp/flagd.socks",
|
|
67
68
|
}))
|
|
@@ -72,7 +73,7 @@ Alternatively, you can use socket paths to connect to flagd.
|
|
|
72
73
|
This mode performs flag evaluations locally (in-process).
|
|
73
74
|
Flag configurations for evaluation are obtained via gRPC protocol using [sync protobuf schema](https://buf.build/open-feature/flagd/file/main:sync/v1/sync_service.proto) service definition.
|
|
74
75
|
|
|
75
|
-
```
|
|
76
|
+
```ts
|
|
76
77
|
OpenFeature.setProvider(new FlagdProvider({
|
|
77
78
|
resolverType: 'in-process',
|
|
78
79
|
}))
|
|
@@ -83,7 +84,7 @@ In the above example, the provider expects a flag sync service implementation to
|
|
|
83
84
|
In-process resolver can also work in an offline mode.
|
|
84
85
|
To enable this mode, you should provide a valid flag configuration file with the option `offlineFlagSourcePath`.
|
|
85
86
|
|
|
86
|
-
```
|
|
87
|
+
```ts
|
|
87
88
|
OpenFeature.setProvider(new FlagdProvider({
|
|
88
89
|
resolverType: 'in-process',
|
|
89
90
|
offlineFlagSourcePath: './flags.json',
|
|
@@ -93,6 +94,18 @@ To enable this mode, you should provide a valid flag configuration file with the
|
|
|
93
94
|
Offline mode uses `fs.watchFile` and polls every 5 seconds for changes to the file.
|
|
94
95
|
This mode is useful for local development, test cases, and for offline applications.
|
|
95
96
|
|
|
97
|
+
### Default Authority usage (optional)
|
|
98
|
+
|
|
99
|
+
This is useful for complex routing or service-discovery use cases that involve a proxy (e.g., Envoy).
|
|
100
|
+
Please refer to this [GitHub issue](https://github.com/open-feature/js-sdk-contrib/issues/1187) for more information.
|
|
101
|
+
|
|
102
|
+
```ts
|
|
103
|
+
OpenFeature.setProvider(new FlagdProvider({
|
|
104
|
+
resolverType: 'in-process',
|
|
105
|
+
defaultAuthority: 'b-target-api.service',
|
|
106
|
+
}))
|
|
107
|
+
```
|
|
108
|
+
|
|
96
109
|
### Supported Events
|
|
97
110
|
|
|
98
111
|
The flagd provider emits `PROVIDER_READY`, `PROVIDER_ERROR` and `PROVIDER_CONFIGURATION_CHANGED` events.
|
|
@@ -107,9 +120,8 @@ For general information on events, see the [official documentation](https://open
|
|
|
107
120
|
|
|
108
121
|
### Flag Metadata
|
|
109
122
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
| `scope` | string | "selector" set for the associated source in flagd |
|
|
123
|
+
[Flag metadata](https://flagd.dev/reference/flag-definitions/#metadata) is a set of key-value pairs that can be associated with a flag.
|
|
124
|
+
The values come from the flag definition in flagd.
|
|
113
125
|
|
|
114
126
|
## Building
|
|
115
127
|
|